From mboxrd@z Thu Jan 1 00:00:00 1970 From: john at keeping.me.uk (John Keeping) Date: Mon, 8 Apr 2013 19:52:20 +0100 Subject: [PATCH] Do not load system gitconfig and gitattributes In-Reply-To: References: <51630879.8080208@hupie.com> <20130408182208.GU2222@serenity.lan> <51630E8E.2090508@hupie.com> <20130408184743.GY2222@serenity.lan> Message-ID: <20130408185220.GA2222@serenity.lan> Since we do not explicitly configure Git's build, the system configuration directory will point at $HOME/etc which is unlikely to be useful and may be very bad, for example if the user builds as root then the files will be inaccessible and cause CGit to exit prematurely. Fix this by exporting GIT_ATTR_NOSYSTEM=1 and GIT_CONFIG_NOSYSTEM=1 at the beginning of main. Note that we use setenv with overwrite=0 so that users who require this functionality can still get it by setting the variables to "0" or "false" before invoking CGit. Reported-by: Ferry Huberts Signed-off-by: John Keeping --- On Mon, Apr 08, 2013 at 08:48:19PM +0200, Jason A. Donenfeld wrote: > On Mon, Apr 8, 2013 at 8:47 PM, John Keeping wrote: > > There was a change in Git to promote permission denied from a silent > > failure to a warning (IIRC). I'm surprised that this causes CGit to > > exit but I haven't followed that code carefully. > > Triaging. Standby. I think this patch is sensible regardless of the cause... cgit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cgit.c b/cgit.c index f73c7b0..78805c7 100644 --- a/cgit.c +++ b/cgit.c @@ -815,6 +815,9 @@ int main(int argc, const char **argv) const char *path; int err, ttl; + setenv("GIT_ATTR_NOSYSTEM", "1", 0); + setenv("GIT_CONFIG_NOSYSTEM", "1", 0); + prepare_context(&ctx); cgit_repolist.length = 0; cgit_repolist.count = 0; -- 1.8.2.694.ga76e9c3.dirty