{"thread":{"id":"19222","subject":"[PATCH] To make GIT-VERSION-FILE, search for git more widely","startedAt":"2009-05-07T08:24:26Z","lastAt":"2009-05-07T09:13:21Z","messageCount":13,"participants":["Matthias Andree","Johannes Sixt","Junio C Hamano","Nicolas Sebrecht","Michael J Gruber"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"113181","messageId":"1241684666-18956-1-git-send-email-matthias.andree@gmx.de","threadId":"19222","inReplyTo":null,"subject":"[PATCH] To make GIT-VERSION-FILE, search for git more widely","fromName":"Matthias Andree","fromEmail":"matthias.andree@gmx.de","sentAt":"2009-05-07T08:24:26Z","receivedAt":"2009-05-07T08:24:26Z","isPatch":true,"sender":{"key":"matthias.andree@gmx.de","avatar":null},"body":"Problem: when git is installed into /usr/local/bin, running 'sudo make\ninstall' won't find git in $PATH (because sudo strips PATH, for instance\non openSUSE 11.1, and doesn't include /usr/local/whatever).\n\nThis causes GIT-VERSION-FILE to not find git for git describe, and fall\nback to DEF_VER.\n\nThis in turn causes rebuilds of major parts of the system.\n\nThis patch passes GIT through to the shell script, and additionally\nlooks for the current version and in ${prefix}/bin.\n\nSigned-off-by: Matthias Andree <matthias.andree@gmx.de>\n---\n GIT-VERSION-GEN |    7 ++++---\n Makefile        |    6 +++++-\n 2 files changed, 9 insertions(+), 4 deletions(-)\n\ndiff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN\nindex 39cde78..66c171e 100755\n--- a/GIT-VERSION-GEN\n+++ b/GIT-VERSION-GEN\n@@ -2,6 +2,7 @@\n \n GVF=GIT-VERSION-FILE\n DEF_VER=v1.6.3.GIT\n+test -x \"$GIT\" || GIT=git\n \n LF='\n '\n@@ -12,12 +13,12 @@ if test -f version\n then\n \tVN=$(cat version) || VN=\"$DEF_VER\"\n elif test -d .git -o -f .git &&\n-\tVN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&\n+\tVN=$(${GIT} describe --abbrev=4 HEAD 2>/dev/null) &&\n \tcase \"$VN\" in\n \t*$LF*) (exit 1) ;;\n \tv[0-9]*)\n-\t\tgit update-index -q --refresh\n-\t\ttest -z \"$(git diff-index --name-only HEAD --)\" ||\n+\t\t${GIT} update-index -q --refresh\n+\t\ttest -z \"$(${GIT} diff-index --name-only HEAD --)\" ||\n \t\tVN=\"$VN-dirty\" ;;\n \tesac\n then\ndiff --git a/Makefile b/Makefile\nindex 6e21643..8e34877 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -177,7 +177,11 @@ all::\n # away (some NTFS drivers seem to zero the contents in that scenario).\n \n GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE\n-\t@$(SHELL_PATH) ./GIT-VERSION-GEN\n+\t@{ GIT=./git$X ; type $$GIT >/dev/null 2>&1 ; } \\\n+\t    || { GIT=$(prefix)/bin/git$X ; type $$GIT >/dev/null 2>&1 ; }\\\n+\t    || GIT=git ; \\\n+\t    export GIT ; \\\n+\t    $(SHELL_PATH) ./GIT-VERSION-GEN\n -include GIT-VERSION-FILE\n \n uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')\n-- \n1.6.3.rc2.9.g97ad0\n"},{"id":"113182","messageId":"4A029B9B.7090706@viscovery.net","threadId":"19222","inReplyTo":"1241684666-18956-1-git-send-email-matthias.andree@gmx.de","subject":"Re: [PATCH] To make GIT-VERSION-FILE, search for git more widely","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-05-07T08:28:11Z","receivedAt":"2009-05-07T08:28:11Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Matthias Andree schrieb:\n> Problem: when git is installed into /usr/local/bin, running 'sudo make\n> install' won't find git in $PATH (because sudo strips PATH, for instance\n> on openSUSE 11.1, and doesn't include /usr/local/whatever).\n> \n> This causes GIT-VERSION-FILE to not find git for git describe, and fall\n> back to DEF_VER.\n> \n> This in turn causes rebuilds of major parts of the system.\n> \n> This patch passes GIT through to the shell script, and additionally\n> looks for the current version and in ${prefix}/bin.\n> \n> Signed-off-by: Matthias Andree <matthias.andree@gmx.de>\n> ---\n>  GIT-VERSION-GEN |    7 ++++---\n>  Makefile        |    6 +++++-\n>  2 files changed, 9 insertions(+), 4 deletions(-)\n> \n> diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN\n> index 39cde78..66c171e 100755\n> --- a/GIT-VERSION-GEN\n> +++ b/GIT-VERSION-GEN\n> @@ -2,6 +2,7 @@\n>  \n>  GVF=GIT-VERSION-FILE\n>  DEF_VER=v1.6.3.GIT\n> +test -x \"$GIT\" || GIT=git\n>  \n>  LF='\n>  '\n> @@ -12,12 +13,12 @@ if test -f version\n>  then\n>  \tVN=$(cat version) || VN=\"$DEF_VER\"\n>  elif test -d .git -o -f .git &&\n> -\tVN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&\n> +\tVN=$(${GIT} describe --abbrev=4 HEAD 2>/dev/null) &&\n\n+\tVN=$(${GIT} describe --abbrev=4 HEAD 2>/dev/null) &&\n>  \tcase \"$VN\" in\n>  \t*$LF*) (exit 1) ;;\n>  \tv[0-9]*)\n> -\t\tgit update-index -q --refresh\n> -\t\ttest -z \"$(git diff-index --name-only HEAD --)\" ||\n> +\t\t${GIT} update-index -q --refresh\n> +\t\ttest -z \"$(${GIT} diff-index --name-only HEAD --)\" ||\n>  \t\tVN=\"$VN-dirty\" ;;\n>  \tesac\n>  then\n> diff --git a/Makefile b/Makefile\n> index 6e21643..8e34877 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -177,7 +177,11 @@ all::\n>  # away (some NTFS drivers seem to zero the contents in that scenario).\n>  \n>  GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE\n> -\t@$(SHELL_PATH) ./GIT-VERSION-GEN\n> +\t@{ GIT=./git$X ; type $$GIT >/dev/null 2>&1 ; } \\\n> +\t    || { GIT=$(prefix)/bin/git$X ; type $$GIT >/dev/null 2>&1 ; }\\\n> +\t    || GIT=git ; \\\n> +\t    export GIT ; \\\n> +\t    $(SHELL_PATH) ./GIT-VERSION-GEN\n>  -include GIT-VERSION-FILE\n>  \n>  uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')\n\n\n-- \nDI Johannes Sixt\nLeiter Softwareentwicklung\nViscovery Software GmbH\nLandstrasse 11\nA-4020 Linz, Austria\n\nT: +43-1-532 0570-51\nM: +43-676-8494 9571\nF: +43-1-532 0570-33\nj.sixt@viscovery.net\nwww.viscovery.net\n\nt u r n   y o u r   d a t a   i n t o   r e a l   v a l u e !\n"},{"id":"113183","messageId":"7vws8te2ht.fsf@alter.siamese.dyndns.org","threadId":"19222","inReplyTo":"1241684666-18956-1-git-send-email-matthias.andree@gmx.de","subject":"Re: [PATCH] To make GIT-VERSION-FILE, search for git more widely","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-05-07T08:33:34Z","receivedAt":"2009-05-07T08:33:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthias Andree <matthias.andree@gmx.de> writes:\n\n> Problem: when git is installed into /usr/local/bin, running 'sudo make\n> install' won't find git in $PATH (because sudo strips PATH, for instance\n> on openSUSE 11.1, and doesn't include /usr/local/whatever).\n\nThat sounds like a bug/misfeature in sudo (which I do not use) to me.\n"},{"id":"113184","messageId":"4A029D43.4030604@viscovery.net","threadId":"19222","inReplyTo":"1241684666-18956-1-git-send-email-matthias.andree@gmx.de","subject":"Re: [PATCH] To make GIT-VERSION-FILE, search for git more widely","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-05-07T08:35:15Z","receivedAt":"2009-05-07T08:35:15Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"(sorry for the previous message; fingers were too fast)\n\nMatthias Andree schrieb:\n> +\tVN=$(${GIT} describe --abbrev=4 HEAD 2>/dev/null) &&\n\n> +\t\t${GIT} update-index -q --refresh\n> +\t\ttest -z \"$(${GIT} diff-index --name-only HEAD --)\" ||\n\nUse \"$GIT\" in all those cases\n\n>  GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE\n> -\t@$(SHELL_PATH) ./GIT-VERSION-GEN\n> +\t@{ GIT=./git$X ; type $$GIT >/dev/null 2>&1 ; } \\\n\n+\t@{ GIT=./git$X ; type \"$$GIT\" >/dev/null 2>&1 ; } \\\n\n> +\t    || { GIT=$(prefix)/bin/git$X ; type $$GIT >/dev/null 2>&1 ; }\\\n\n+\t    || { GIT='$(prefix_SQ)/bin/git$X' ; type \"$$GIT\" >/dev/null 2>&1 ; }\\\n\nBTW, isn't `test -x \"$GIT\"` better in some way than `type \"$GIT\"`?\n\n> +\t    || GIT=git ; \\\n> +\t    export GIT ; \\\n> +\t    $(SHELL_PATH) ./GIT-VERSION-GEN\n\n-- Hannes\n"},{"id":"113185","messageId":"op.utjw1pa71e62zd@merlin.emma.line.org","threadId":"19222","inReplyTo":"7vws8te2ht.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] To make GIT-VERSION-FILE, search for git more widely","fromName":"Matthias Andree","fromEmail":"matthias.andree@gmx.de","sentAt":"2009-05-07T08:40:27Z","receivedAt":"2009-05-07T08:40:27Z","isPatch":true,"sender":{"key":"matthias.andree@gmx.de","avatar":null},"body":"Am 07.05.2009, 10:33 Uhr, schrieb Junio C Hamano <gitster@pobox.com>:\n\n> Matthias Andree <matthias.andree@gmx.de> writes:\n>\n>> Problem: when git is installed into /usr/local/bin, running 'sudo make\n>> install' won't find git in $PATH (because sudo strips PATH, for instance\n>> on openSUSE 11.1, and doesn't include /usr/local/whatever).\n>\n> That sounds like a bug/misfeature in sudo (which I do not use) to me.\n\nSome points:\n\n1. sudo is the default sysadmin setup on Ubuntu (more so than on openSUSE)\n\n2. sudo strips the environment by default for security reasons\n\n3. why would we want to use an old git version (rather than an up to date  \none) to extract the data?\n\n-- \nMatthias Andree\n"},{"id":"113188","messageId":"4A02A008.30800@viscovery.net","threadId":"19222","inReplyTo":"7vws8te2ht.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] To make GIT-VERSION-FILE, search for git more widely","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-05-07T08:47:04Z","receivedAt":"2009-05-07T08:47:04Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Junio C Hamano schrieb:\n> Matthias Andree <matthias.andree@gmx.de> writes:\n> \n>> Problem: when git is installed into /usr/local/bin, running 'sudo make\n>> install' won't find git in $PATH (because sudo strips PATH, for instance\n>> on openSUSE 11.1, and doesn't include /usr/local/whatever).\n> \n> That sounds like a bug/misfeature in sudo (which I do not use) to me.\n\nsudo resets the environment, in particular also PATH. Why would this be a bug?\n\nCurrent distros set env_reset in /etc/soduers for a reason. Not that I\nknow the reason in detail, but I won't claim that I'm more clever with\nregards to security issues than distro packagers; so I trust that if they\ndo it, then it makes sense.\n\n-- Hannes\n"},{"id":"113189","messageId":"20090507085419.GB13123@vidovic","threadId":"19222","inReplyTo":"op.utjw1pa71e62zd@merlin.emma.line.org","subject":"[PATCH] Re: To make GIT-VERSION-FILE, search for git more widely","fromName":"Nicolas Sebrecht","fromEmail":"nicolas.s.dev@gmx.fr","sentAt":"2009-05-07T08:54:19Z","receivedAt":"2009-05-07T08:54:19Z","isPatch":true,"sender":{"key":"nicolas.s.dev@gmx.fr","avatar":null},"body":"The 07/05/09, Matthias Andree wrote:\n\n> Some points:\n>\n> 1. sudo is the default sysadmin setup on Ubuntu (more so than on openSUSE)\n>\n> 2. sudo strips the environment by default for security reasons\n\nThis is a configuration option that the sysadmin has to set (see\nenv_keep in man sudoers (5) or http://linux.die.net/man/5/sudoers).\n\nI don't see any good reason to bypass this behaviour since it is what\nsysadmins expect.\n\n-- \nNicolas Sebrecht\n"},{"id":"113190","messageId":"op.utjxrofj1e62zd@merlin.emma.line.org","threadId":"19222","inReplyTo":"20090507085419.GB13123@vidovic","subject":"Re: [PATCH] Re: To make GIT-VERSION-FILE, search for git more widely","fromName":"Matthias Andree","fromEmail":"matthias.andree@gmx.de","sentAt":"2009-05-07T08:56:02Z","receivedAt":"2009-05-07T08:56:02Z","isPatch":true,"sender":{"key":"matthias.andree@gmx.de","avatar":null},"body":"Am 07.05.2009, 10:54 Uhr, schrieb Nicolas Sebrecht <nicolas.s.dev@gmx.fr>:\n\n> This is a configuration option that the sysadmin has to set (see\n> env_keep in man sudoers (5) or http://linux.die.net/man/5/sudoers).\n\nSalut Nicolas,\n\nI'm aware of that.\n\n> I don't see any good reason to bypass this behaviour since it is what\n> sysadmins expect.\n\nAre you agreeing or objecting?\n\nBest regards\n\n-- \nMatthias Andree\n"},{"id":"113191","messageId":"1241686707-29960-1-git-send-email-matthias.andree@gmx.de","threadId":"19222","inReplyTo":"4A029D43.4030604@viscovery.net","subject":"[PATCH v2] To make GIT-VERSION-FILE, search for git more widely","fromName":"Matthias Andree","fromEmail":"matthias.andree@gmx.de","sentAt":"2009-05-07T08:58:27Z","receivedAt":"2009-05-07T08:58:27Z","isPatch":true,"sender":{"key":"matthias.andree@gmx.de","avatar":null},"body":"Problem: when git is installed into /usr/local/bin, running 'sudo make\ninstall' won't find git in $PATH (because sudo strips PATH for security\nreasons).\n\nThis causes GIT-VERSION-FILE to not find git for git describe, and fall\nback to DEF_VER.  This in turn causes rebuilds of major parts of the system.\n\nTypical failing scenario:\n\nmake configure\n./configure    # defaults to --prefix=/usr/local\nmake all doc\nsudo make install install-doc install-html # REBUILDS HAPPEN HERE\n\nThis patch passes GIT through to the shell script, and additionally\nlooks for the current built version and in ${prefix}/bin.\n\nSigned-off-by: Matthias Andree <matthias.andree@gmx.de>\n---\n GIT-VERSION-GEN |    9 ++++-----\n Makefile        |    6 +++++-\n 2 files changed, 9 insertions(+), 6 deletions(-)\n\ndiff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN\nindex 39cde78..d0dfef3 100755\n--- a/GIT-VERSION-GEN\n+++ b/GIT-VERSION-GEN\n@@ -2,6 +2,7 @@\n \n GVF=GIT-VERSION-FILE\n DEF_VER=v1.6.3.GIT\n+test -x \"$GIT\" || GIT=git\n \n LF='\n '\n@@ -12,12 +13,12 @@ if test -f version\n then\n \tVN=$(cat version) || VN=\"$DEF_VER\"\n elif test -d .git -o -f .git &&\n-\tVN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&\n+\tVN=$($GIT describe --abbrev=4 HEAD 2>/dev/null) &&\n \tcase \"$VN\" in\n \t*$LF*) (exit 1) ;;\n \tv[0-9]*)\n-\t\tgit update-index -q --refresh\n-\t\ttest -z \"$(git diff-index --name-only HEAD --)\" ||\n+\t\t$GIT update-index -q --refresh\n+\t\ttest -z \"$($GIT diff-index --name-only HEAD --)\" ||\n \t\tVN=\"$VN-dirty\" ;;\n \tesac\n then\n@@ -38,5 +39,3 @@ test \"$VN\" = \"$VC\" || {\n \techo >&2 \"GIT_VERSION = $VN\"\n \techo \"GIT_VERSION = $VN\" >$GVF\n }\n-\n-\ndiff --git a/Makefile b/Makefile\nindex 6e21643..d6be483 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -177,7 +177,11 @@ all::\n # away (some NTFS drivers seem to zero the contents in that scenario).\n \n GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE\n-\t@$(SHELL_PATH) ./GIT-VERSION-GEN\n+\t@{ GIT=./git$X ; test -x \"$$GIT\" ; } \\\n+\t    || { GIT=$(prefix)/bin/git$X ; test -x \"$$GIT\" ; }\\\n+\t    || GIT=git ; \\\n+\t    export GIT ; \\\n+\t    $(SHELL_PATH) ./GIT-VERSION-GEN\n -include GIT-VERSION-FILE\n \n uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')\n-- \n1.6.3.rc2.9.g97ad0\n"},{"id":"113193","messageId":"4A02A39A.3000407@drmicha.warpmail.net","threadId":"19222","inReplyTo":"4A02A008.30800@viscovery.net","subject":"Re: [PATCH] To make GIT-VERSION-FILE, search for git more widely","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-05-07T09:02:18Z","receivedAt":"2009-05-07T09:02:18Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Johannes Sixt venit, vidit, dixit 07.05.2009 10:47:\n> Junio C Hamano schrieb:\n>> Matthias Andree <matthias.andree@gmx.de> writes:\n>>\n>>> Problem: when git is installed into /usr/local/bin, running 'sudo make\n>>> install' won't find git in $PATH (because sudo strips PATH, for instance\n>>> on openSUSE 11.1, and doesn't include /usr/local/whatever).\n>>\n>> That sounds like a bug/misfeature in sudo (which I do not use) to me.\n> \n> sudo resets the environment, in particular also PATH. Why would this be a bug?\n> \n> Current distros set env_reset in /etc/soduers for a reason. Not that I\n> know the reason in detail, but I won't claim that I'm more clever with\n> regards to security issues than distro packagers; so I trust that if they\n> do it, then it makes sense.\n> \n> -- Hannes\n\nsudo's behaviour is fine, but the OP's is not: doing \"sudo make install\"\namounts to building git as root, unless you have done a make as non-root\nbefore. If you have done that make then GIT-VERSION-FILE will be\nup-to-date, and GIT-VERSION-GEN will not even be called by \"make install\".\n\nSo I think the proposed patch would encourage wrong behaviour. (also,\nthe commit message mixes up ...-GEN and ...-FILE)\n\nMichael\n"},{"id":"113192","messageId":"op.utjx17xn1e62zd@merlin.emma.line.org","threadId":"19222","inReplyTo":"4A02A008.30800@viscovery.net","subject":"Re: [PATCH] To make GIT-VERSION-FILE, search for git more widely","fromName":"Matthias Andree","fromEmail":"matthias.andree@gmx.de","sentAt":"2009-05-07T09:02:21Z","receivedAt":"2009-05-07T09:02:21Z","isPatch":true,"sender":{"key":"matthias.andree@gmx.de","avatar":null},"body":"Am 07.05.2009, 10:47 Uhr, schrieb Johannes Sixt <j.sixt@viscovery.net>:\n\n> Junio C Hamano schrieb:\n>> Matthias Andree <matthias.andree@gmx.de> writes:\n>>\n>>> Problem: when git is installed into /usr/local/bin, running 'sudo make\n>>> install' won't find git in $PATH (because sudo strips PATH, for  \n>>> instance\n>>> on openSUSE 11.1, and doesn't include /usr/local/whatever).\n>>\n>> That sounds like a bug/misfeature in sudo (which I do not use) to me.\n>\n> sudo resets the environment, in particular also PATH. Why would this be  \n> a bug?\n>\n> Current distros set env_reset in /etc/soduers for a reason. Not that I\n> know the reason in detail, but I won't claim that I'm more clever with\n> regards to security issues than distro packagers; so I trust that if they\n> do it, then it makes sense.\n\ncomments in my suoders file:\n\n| ...\n| # Prevent environment variables from influencing programs in an\n| # unexpected or harmful way (CVE-2005-2959, CVE-2005-4158, CVE-2006-0151)\n| Defaults always_set_home\n| Defaults env_reset\n| ...\n\nI don't bother, this is a convenience-and-usability feature. It has always  \nirritated me why \"make && sudo make install\" would build twice.\n\nLet's fix this for good unless someone can show that this is harmful. (OK,  \nthe $(prefix)/bin/git part might grab an old version, but we may want to  \nuse that for bootstrapping, and it should usually be good enough.)\n\n-- \nMatthias Andree\n"},{"id":"113194","messageId":"20090507090258.GC13123@vidovic","threadId":"19222","inReplyTo":"op.utjxrofj1e62zd@merlin.emma.line.org","subject":"[PATCH] Re: To make GIT-VERSION-FILE, search for git more widely","fromName":"Nicolas Sebrecht","fromEmail":"nicolas.s.dev@gmx.fr","sentAt":"2009-05-07T09:02:58Z","receivedAt":"2009-05-07T09:02:58Z","isPatch":true,"sender":{"key":"nicolas.s.dev@gmx.fr","avatar":null},"body":"The 07/05/09, Matthias Andree wrote:\n> Am 07.05.2009, 10:54 Uhr, schrieb Nicolas Sebrecht <nicolas.s.dev@gmx.fr>:\n>\n> > This is a configuration option that the sysadmin has to set (see\n> > env_keep in man sudoers (5) or http://linux.die.net/man/5/sudoers).\n>\n> Salut Nicolas,\n>\n> I'm aware of that.\n>\n> > I don't see any good reason to bypass this behaviour since it is what\n> > sysadmins expect.\n>\n> Are you agreeing or objecting?\n\nObjecting. By \"this behaviour\" I meant \"the fact that sudo strips\nenvironment variables\".\n\n-- \nNicolas Sebrecht\n"},{"id":"113195","messageId":"op.utjykjwx1e62zd@merlin.emma.line.org","threadId":"19222","inReplyTo":"4A02A39A.3000407@drmicha.warpmail.net","subject":"Re: [PATCH] To make GIT-VERSION-FILE, search for git more widely","fromName":"Matthias Andree","fromEmail":"matthias.andree@gmx.de","sentAt":"2009-05-07T09:13:21Z","receivedAt":"2009-05-07T09:13:21Z","isPatch":true,"sender":{"key":"matthias.andree@gmx.de","avatar":null},"body":"Am 07.05.2009, 11:02 Uhr, schrieb Michael J Gruber  \n<git@drmicha.warpmail.net>:\n\n> Johannes Sixt venit, vidit, dixit 07.05.2009 10:47:\n>> Junio C Hamano schrieb:\n>>> Matthias Andree <matthias.andree@gmx.de> writes:\n>>>\n>>>> Problem: when git is installed into /usr/local/bin, running 'sudo make\n>>>> install' won't find git in $PATH (because sudo strips PATH, for  \n>>>> instance\n>>>> on openSUSE 11.1, and doesn't include /usr/local/whatever).\n>>>\n>>> That sounds like a bug/misfeature in sudo (which I do not use) to me.\n>>\n>> sudo resets the environment, in particular also PATH. Why would this be  \n>> a bug?\n>>\n>> Current distros set env_reset in /etc/soduers for a reason. Not that I\n>> know the reason in detail, but I won't claim that I'm more clever with\n>> regards to security issues than distro packagers; so I trust that if  \n>> they\n>> do it, then it makes sense.\n>>\n>> -- Hannes\n>\n> sudo's behaviour is fine, but the OP's is not: doing \"sudo make install\"\n> amounts to building git as root, unless you have done a make as non-root\n> before. If you have done that make then GIT-VERSION-FILE will be\n> up-to-date, and GIT-VERSION-GEN will not even be called by \"make  \n> install\".\n\nMichael,\n\nbelieve me that I've thoroughly analyzed this before proposing the change.\n\nMore details in the followup - I need to fix the commit message :-)\n\n> So I think the proposed patch would encourage wrong behaviour. (also,\n> the commit message mixes up ...-GEN and ...-FILE)\n\nWhoops, good catch. PATCH v3 in a minute.\n\nBest regards\n\n-- \nMatthias Andree\n"}]}