{"thread":{"id":"7812","subject":"[PATCH] Only use ETC_GITCONFIG=$(prefix)/etc/gitconfig ifeq ($(prefix),$(HOME))","startedAt":"2007-04-24T02:11:06Z","lastAt":"2007-04-24T09:05:36Z","messageCount":11,"participants":["Josh Triplett","Junio C Hamano","Shawn O. Pearce","Sergio Callegari"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"40282","messageId":"462D673A.1010805@freedesktop.org","threadId":"7812","inReplyTo":null,"subject":"[PATCH] Only use ETC_GITCONFIG=$(prefix)/etc/gitconfig ifeq ($(prefix),$(HOME))","fromName":"Josh Triplett","fromEmail":"josh@freedesktop.org","sentAt":"2007-04-24T02:11:06Z","receivedAt":"2007-04-24T02:11:06Z","isPatch":true,"sender":{"key":"josh@joshtriplett.org","avatar":"https://avatars.githubusercontent.com/u/162737?v=4"},"body":"ETC_GITCONFIG defaults to $(prefix)/etc/gitconfig, so if you just set\nprefix=/usr or prefix=/usr/local, you end up with a git that looks in\n/usr/etc/gitconfig or /usr/local/etc/gitconfig.  That seems rather suboptimal.\n\nUse ifeq in the Makefile to set ETC_GITCONFIG=/etc/gitconfig unless the prefix\npoints to $HOME .\n\nThe builder can always override ETC_GITCONFIG, so this just makes the default\nsaner.\n\nSigned-off-by: Josh Triplett <josh@freedesktop.org>\n---\n Makefile |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 65bd2db..6e1ae95 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -141,7 +141,11 @@ prefix = $(HOME)\n bindir = $(prefix)/bin\n gitexecdir = $(bindir)\n template_dir = $(prefix)/share/git-core/templates/\n-ETC_GITCONFIG = $(prefix)/etc/gitconfig\n+ifeq ($(prefix),$(HOME))\n+ETC_GITCONFIG = $(HOME)/etc/gitconfig\n+else\n+ETC_GITCONFIG = /etc/gitconfig\n+endif\n # DESTDIR=\n \n # default configuration for gitweb\n-- \n1.5.1.1\n\n\n"},{"id":"40285","messageId":"7vhcr6bdmk.fsf@assigned-by-dhcp.cox.net","threadId":"7812","inReplyTo":"462D673A.1010805@freedesktop.org","subject":"Re: [PATCH] Only use ETC_GITCONFIG=$(prefix)/etc/gitconfig ifeq ($(prefix),$(HOME))","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-24T04:27:47Z","receivedAt":"2007-04-24T04:27:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Is this really necessary?\n\nI personally think distro people (or anybody who configures git\nfor system-wide deployment for that matter) already has Makefile\nwrapper (a la debian/rules) to take care of this and other\nissues.\n"},{"id":"40290","messageId":"462D9938.8020206@freedesktop.org","threadId":"7812","inReplyTo":"7vhcr6bdmk.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Only use ETC_GITCONFIG=$(prefix)/etc/gitconfig ifeq ($(prefix),$(HOME))","fromName":"Josh Triplett","fromEmail":"josh@freedesktop.org","sentAt":"2007-04-24T05:44:24Z","receivedAt":"2007-04-24T05:44:24Z","isPatch":true,"sender":{"key":"josh@joshtriplett.org","avatar":"https://avatars.githubusercontent.com/u/162737?v=4"},"body":"Junio C Hamano wrote:\n> Is this really necessary?\n> \n> I personally think distro people (or anybody who configures git\n> for system-wide deployment for that matter) already has Makefile\n> wrapper (a la debian/rules) to take care of this and other\n> issues.\n\nSo did I.  Then I noticed (while stracing git to diagnose the issue with\ngit-add searching the whole working copy for .gitignore files) that the\nDebian-packaged git looked for /usr/etc/gitconfig.  See\n<http://bugs.debian.org/420675>.  Apparently few enough people use\n/etc/gitconfig that nobody noticed and reported that it didn't work. :)\n\nWhy not make the defaults more resistant to broken configuration?\n\n- Josh Triplett\n\n"},{"id":"40291","messageId":"7vlkgi9utk.fsf@assigned-by-dhcp.cox.net","threadId":"7812","inReplyTo":"462D9938.8020206@freedesktop.org","subject":"Re: [PATCH] Only use ETC_GITCONFIG=$(prefix)/etc/gitconfig ifeq ($(prefix),$(HOME))","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-24T05:59:19Z","receivedAt":"2007-04-24T05:59:19Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Josh Triplett <josh@freedesktop.org> writes:\n\n> Junio C Hamano wrote:\n>> Is this really necessary?\n>> \n>> I personally think distro people (or anybody who configures git\n>> for system-wide deployment for that matter) already has Makefile\n>> wrapper (a la debian/rules) to take care of this and other\n>> issues.\n>\n> So did I.  Then I noticed (while stracing git to diagnose the issue with\n> git-add searching the whole working copy for .gitignore files) that the\n> Debian-packaged git looked for /usr/etc/gitconfig.  See\n> <http://bugs.debian.org/420675>.  Apparently few enough people use\n> /etc/gitconfig that nobody noticed and reported that it didn't work. :)\n>\n> Why not make the defaults more resistant to broken configuration?\n\nHmm.\n\nIt's tempting to leave this as is to gauge which distribution\nhas more competent package maintainer and which ones have sloppy\nones ;-).\n\nSympathetic, but still not entirely convinced.\n"},{"id":"40292","messageId":"7v8xci9uea.fsf@assigned-by-dhcp.cox.net","threadId":"7812","inReplyTo":"462D673A.1010805@freedesktop.org","subject":"Re: [PATCH] Only use ETC_GITCONFIG=$(prefix)/etc/gitconfig ifeq ($(prefix),$(HOME))","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-24T06:08:29Z","receivedAt":"2007-04-24T06:08:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Josh Triplett <josh@freedesktop.org> writes:\n\n> ETC_GITCONFIG defaults to $(prefix)/etc/gitconfig, so if you just set\n> prefix=/usr or prefix=/usr/local, you end up with a git that looks in\n> /usr/etc/gitconfig or /usr/local/etc/gitconfig.  That seems rather suboptimal.\n>\n> Use ifeq in the Makefile to set ETC_GITCONFIG=/etc/gitconfig unless the prefix\n> points to $HOME .\n\nI personally have four installations of git under $HOME by\nsetting prefix to $HOME/git-{maint,master,next,pu}.  I would\nrather not see this to break, as I suspect there are other\npeople who depend on this behaviour.\n"},{"id":"40294","messageId":"7v1wia9u02.fsf@assigned-by-dhcp.cox.net","threadId":"7812","inReplyTo":"7v8xci9uea.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Only use ETC_GITCONFIG=$(prefix)/etc/gitconfig ifeq ($(prefix),$(HOME))","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-24T06:17:01Z","receivedAt":"2007-04-24T06:17:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> Josh Triplett <josh@freedesktop.org> writes:\n>\n>> ETC_GITCONFIG defaults to $(prefix)/etc/gitconfig, so if you just set\n>> prefix=/usr or prefix=/usr/local, you end up with a git that looks in\n>> /usr/etc/gitconfig or /usr/local/etc/gitconfig.  That seems rather suboptimal.\n>>\n>> Use ifeq in the Makefile to set ETC_GITCONFIG=/etc/gitconfig unless the prefix\n>> points to $HOME .\n>\n> I personally have four installations of git under $HOME by\n> setting prefix to $HOME/git-{maint,master,next,pu}.  I would\n> rather not see this to break, as I suspect there are other\n> people who depend on this behaviour.\n\nAlso what happens to people who use \"prefix=/usr/local\"?\n"},{"id":"40295","messageId":"20070424061911.GQ17480@spearce.org","threadId":"7812","inReplyTo":"7v8xci9uea.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Only use ETC_GITCONFIG=$(prefix)/etc/gitconfig ifeq ($(prefix),$(HOME))","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-04-24T06:19:11Z","receivedAt":"2007-04-24T06:19:11Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Junio C Hamano <junkio@cox.net> wrote:\n> Josh Triplett <josh@freedesktop.org> writes:\n> > Use ifeq in the Makefile to set ETC_GITCONFIG=/etc/gitconfig unless the prefix\n> > points to $HOME .\n> \n> I personally have four installations of git under $HOME by\n> setting prefix to $HOME/git-{maint,master,next,pu}.  I would\n> rather not see this to break, as I suspect there are other\n> people who depend on this behaviour.\n\nI second that.  :-)\n\n$ cat config.mak\n...\ncurrent_branch := \\\n\t$(subst refs/heads/,,$(shell git-symbolic-ref HEAD 2>/dev/null))\nifeq ($(current_branch),)\n\tprefix := $(HOME)/sw/git-unknownbuild\nelse\n\tprefix := $(HOME)/sw/git-$(current_branch)\nEOF\n\n;-)\n\n-- \nShawn.\n"},{"id":"40298","messageId":"462DB07C.5060500@freedesktop.org","threadId":"7812","inReplyTo":"7vlkgi9utk.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Only use ETC_GITCONFIG=$(prefix)/etc/gitconfig ifeq ($(prefix),$(HOME))","fromName":"Josh Triplett","fromEmail":"josh@freedesktop.org","sentAt":"2007-04-24T07:23:40Z","receivedAt":"2007-04-24T07:23:40Z","isPatch":true,"sender":{"key":"josh@joshtriplett.org","avatar":"https://avatars.githubusercontent.com/u/162737?v=4"},"body":"Junio C Hamano wrote:\n> Josh Triplett <josh@freedesktop.org> writes:\n> \n>> Junio C Hamano wrote:\n>>> Is this really necessary?\n>>>\n>>> I personally think distro people (or anybody who configures git\n>>> for system-wide deployment for that matter) already has Makefile\n>>> wrapper (a la debian/rules) to take care of this and other\n>>> issues.\n>> So did I.  Then I noticed (while stracing git to diagnose the issue with\n>> git-add searching the whole working copy for .gitignore files) that the\n>> Debian-packaged git looked for /usr/etc/gitconfig.  See\n>> <http://bugs.debian.org/420675>.  Apparently few enough people use\n>> /etc/gitconfig that nobody noticed and reported that it didn't work. :)\n>>\n>> Why not make the defaults more resistant to broken configuration?\n> \n> Hmm.\n> \n> It's tempting to leave this as is to gauge which distribution\n> has more competent package maintainer and which ones have sloppy\n> ones ;-).\n>\n> Sympathetic, but still not entirely convinced.\n\ncommit cc58fc0684396c5298b21c97f00a568e46224258\nMerge: 8a13bec... 8565d2d...\nAuthor: Junio C Hamano <junkio@cox.net>\nDate:   Sat Feb 24 01:43:28 2007 -0800\n\n    Merge branch 'js/etc-config'\n\n    * js/etc-config:\n      Make tests independent of global config files\n      config: read system-wide defaults from /etc/gitconfig\n\n\nFairly recent feature, only a few Debian package releases have come out since\nthen, and I strongly suspect that few people use /etc/gitconfig.  I didn't\neven know it existed until the strace, and none of the other Git users I know\nuse it.\n\nIt seems harder to make the mistake *now*, while looking at the Makefile to\nsee what variables need setting, but it seems easy to have not noticed the\nnecessary change for existing packaging.\n\nFurthermore, people often forget the same thing with autofoo-based programs;\n--prefix=/usr or --prefix=/usr/local works for many programs (since a small\nfraction of autofoo-using programs have systemwide configuration, compared to\nall autoconf programs), and it seems easy enough to forget about\n--sysconfdir=/etc.  Most of the time, however, the configuration file gets\nused more often, and often a default version exists that would get installed\nto the wrong place, so this mistake gets more readily noticed.\n\ngit does not install a default systemwide configuration file, and it does not\nattempt to create the target etc directory, making it easy to not notice the\nmistake.  In order to notice, you would have to re-read the Makefile in\ndetail, read the git-config manpage in detail (it shows up in no other\ndocumentation), read the source code, or notice a line in an strace.  Or you\nwould have to get a bugreport from someone using /etc/gitconfig, but again,\nfew do.\n\nFinally, more people install Git than just experienced and observant package\nmaintainers.  Random sysadmins install Git too (I know some of them), and\nmaking life easier for them seems like a good idea.\n\nOverall, this seems like an easy change, with good benefits, and no drawbacks\nthat I can see.\n\n\nThat said, I can see another way to make it slightly more forward-looking:\ncreate a sysconfdir variable in Makefile, like the existing bindir and\ngitexecdir, and apply the appropriate logic to it instead.  Then, any future\nconfiguration files can take advantage of the same logic.\n\nFurthermore, I think my original logic may have a flaw in it: someone\ninstalling with prefix=$HOME/local (which I do for other software, though not\nGit because I use the Debian package) would likely expect $(prefix)/etc as\nwell.  For /usr/local, it can go either way; some people apparently do expect\n/usr/local/etc and some people expect /etc.  Overall, someone installing in a\nstrange nonstandard location probably wants $(prefix)/etc.  So, I think the\nright logic for sysconfdir looks like:\n\nifeq ($(prefix),/usr)\nsysconfdir=/etc\nelse\nsysconfdir=$(prefix)/etc\nendif\n\nPersonally, I wish automake and autoconf had exactly the same logic; it just\nmakes sense.\n\n- Josh Triplett\n\n"},{"id":"40302","messageId":"462DB707.4000008@freedesktop.org","threadId":"7812","inReplyTo":"462DB07C.5060500@freedesktop.org","subject":"[PATCH] Create a sysconfdir variable, and use it for ETC_GITCONFIG","fromName":"Josh Triplett","fromEmail":"josh@freedesktop.org","sentAt":"2007-04-24T07:51:35Z","receivedAt":"2007-04-24T07:51:35Z","isPatch":true,"sender":{"key":"josh@joshtriplett.org","avatar":"https://avatars.githubusercontent.com/u/162737?v=4"},"body":"ETC_GITCONFIG defaults to $(prefix)/etc/gitconfig, so if you just set\nprefix=/usr, you end up with a git that looks in /usr/etc/gitconfig, rather\nthan /etc/gitconfig as specified by the FHS.  Furthermore, setting\nETC_GITCONFIG does not fix the paths to any future system-wide configuration\nfiles.\n\nFactor out the path to the system-wide configuration directory into a variable\nsysconfdir, normally set to $(prefix)/etc, but set to /etc when prefix=/usr .\nThis fixes the prefix=/usr problem for ETC_GITCONFIG, and allows centralized\nconfiguration of any future system-wide configuration files without requiring\nfurther action from package maintainers or other people building and\ninstalling git.\n\nSigned-off-by: Josh Triplett <josh@freedesktop.org>\n---\n Makefile |    9 +++++++--\n 1 files changed, 7 insertions(+), 2 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 65bd2db..60c41fd 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -141,7 +141,12 @@ prefix = $(HOME)\n bindir = $(prefix)/bin\n gitexecdir = $(bindir)\n template_dir = $(prefix)/share/git-core/templates/\n-ETC_GITCONFIG = $(prefix)/etc/gitconfig\n+ifeq ($(prefix),/usr)\n+sysconfdir = /etc\n+else\n+sysconfdir = $(prefix)/etc\n+endif\n+ETC_GITCONFIG = $(sysconfdir)/gitconfig\n # DESTDIR=\n \n # default configuration for gitweb\n@@ -160,7 +165,7 @@ GITWEB_FAVICON = git-favicon.png\n GITWEB_SITE_HEADER =\n GITWEB_SITE_FOOTER =\n \n-export prefix bindir gitexecdir template_dir\n+export prefix bindir gitexecdir template_dir sysconfdir\n \n CC = gcc\n AR = ar\n-- \n1.5.1.1\n\n\n"},{"id":"40303","messageId":"7vwt028a3q.fsf@assigned-by-dhcp.cox.net","threadId":"7812","inReplyTo":"462DB707.4000008@freedesktop.org","subject":"Re: [PATCH] Create a sysconfdir variable, and use it for ETC_GITCONFIG","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-04-24T08:12:09Z","receivedAt":"2007-04-24T08:12:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I like this much better.  Let's have this in 'maint' then.\n"},{"id":"40310","messageId":"loom.20070424T105805-25@post.gmane.org","threadId":"7812","inReplyTo":"7v1wia9u02.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Only use ETC_GITCONFIG=$(prefix)/etc/gitconfig ifeq ($(prefix),$(HOME))","fromName":"Sergio Callegari","fromEmail":"scallegari@arces.unibo.it","sentAt":"2007-04-24T09:05:36Z","receivedAt":"2007-04-24T09:05:36Z","isPatch":true,"sender":{"key":"scallegari@arces.unibo.it","avatar":null},"body":"> Junio C Hamano <junkio <at> cox.net> writes:\n> \n> > Josh Triplett <josh <at> freedesktop.org> writes:\n> >\n> >> ETC_GITCONFIG defaults to $(prefix)/etc/gitconfig, so if you just set\n> >> prefix=/usr or prefix=/usr/local, you end up with a git that looks in\n> >> /usr/etc/gitconfig or /usr/local/etc/gitconfig.  That seems rather\nsuboptimal.\n> >>\n> Also what happens to people who use \"prefix=/usr/local\"?\n>  \n\nCould it be better to set ETC_GITCONFIG=/etc/gitconfig /only/ if prefix is /usr?\n\nThese would possibly make all people who have git in /usr/local or in /opt/Git\nor in /home happier...\n\nIf I am not wrong, /usr is the only prefix, where, for historical reasons\nthere is no /usr/etc but /etc is used.  Having /usr/local/etc does not seem that\nbad. And /opt/Git/etc appears surely ok.\n\nSergio\n"}]}