{"thread":{"id":"13743","subject":"[PATCH review] Build: make PERL_PATH = /usr/bin/env perl","startedAt":"2008-05-31T18:34:46Z","lastAt":"2008-06-02T02:17:25Z","messageCount":7,"participants":["Michael Witten","Junio C Hamano","Matthieu Moy","Steven Walter","David Christensen"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"78241","messageId":"1212258886-87484-1-git-send-email-mfwitten@mit.edu","threadId":"13743","inReplyTo":null,"subject":"[PATCH review] Build: make PERL_PATH = /usr/bin/env perl","fromName":"Michael Witten","fromEmail":"mfwitten@mit.edu","sentAt":"2008-05-31T18:34:46Z","receivedAt":"2008-05-31T18:34:46Z","isPatch":true,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"This should make PERL_PATH more robust, as some\nsystems may have multiple version of perl installed.\n\nSigned-off-by: Michael Witten <mfwitten@mit.edu>\n---\n Makefile |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 865e2bf..5828745 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -323,7 +323,7 @@ ifndef SHELL_PATH\n \tSHELL_PATH = /bin/sh\n endif\n ifndef PERL_PATH\n-\tPERL_PATH = /usr/bin/perl\n+\tPERL_PATH = /usr/bin/env perl\n endif\n \n export PERL_PATH\n-- \n1.5.5.GIT\n"},{"id":"78244","messageId":"7vabi6fdun.fsf@gitster.siamese.dyndns.org","threadId":"13743","inReplyTo":"1212258886-87484-1-git-send-email-mfwitten@mit.edu","subject":"Re: [PATCH review] Build: make PERL_PATH = /usr/bin/env perl","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-05-31T19:55:12Z","receivedAt":"2008-05-31T19:55:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael Witten <mfwitten@MIT.EDU> writes:\n\n> This should make PERL_PATH more robust, as some\n> systems may have multiple version of perl installed.\n>\n> Signed-off-by: Michael Witten <mfwitten@mit.edu>\n> ---\n>  Makefile |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n>\n> diff --git a/Makefile b/Makefile\n> index 865e2bf..5828745 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -323,7 +323,7 @@ ifndef SHELL_PATH\n>  \tSHELL_PATH = /bin/sh\n>  endif\n>  ifndef PERL_PATH\n> -\tPERL_PATH = /usr/bin/perl\n> +\tPERL_PATH = /usr/bin/env perl\n>  endif\n>  \n>  export PERL_PATH\n\nIf you insist, you can do so from your \"make\" command line, but I'd prefer\nthe default configuration as vanilla as possible.\n\nI notice that both git-svn.perl and git-relink.perl begin with\n\"#!/usr/bin/env perl\", and I think that is a mistake.  The #! line is\nrewritten by Makefile, and there is no reason to write a \"/usr/bin/env\"\nugliness there in the source.  Not that it hurts, as it is blown away when\nMakefile rewrites it to \"#!$(PERL_PATH)\", but it still looks ugly.\n"},{"id":"78272","messageId":"8F19F8D7-A9D3-41F5-9F64-1E955BC08DF0@mit.edu","threadId":"13743","inReplyTo":"7vabi6fdun.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH review] Build: make PERL_PATH = /usr/bin/env perl","fromName":"Michael Witten","fromEmail":"mfwitten@mit.edu","sentAt":"2008-06-01T04:48:31Z","receivedAt":"2008-06-01T04:48:31Z","isPatch":true,"sender":{"key":"mfwitten@gmail.com","avatar":"https://avatars.githubusercontent.com/u/597101?v=4"},"body":"\nOn 31 May 2008, at 3:55 PM, Junio C Hamano wrote:\n\n> If you insist, you can do so from your \"make\" command line, but I'd  \n> prefer\n> the default configuration as vanilla as possible.\n\nThe main trouble I've run into is with multiple versions of perl  \ninstalled.\nFor instance, it is unadvisable to overwrite the Mac OS X provided perl\ndistribution. Consequently, custom installations are usually put into\n/usr/local (also, MacPorts install everything into /opt/local).\n\nThis means that a 'vanilla' configuration may not (most likely will  \nnot) make\nuse of the perl distribution that is actually employed by the user.\n\nThis matters, because some tools like git-send-email require extra CPAN\nmodules such as Net::SMTP::SSL, which won't be found unless git has been\nconfigured with a custom PERL_PATH.\n\nIt would seem to me that something like '/usr/bin/env perl' is slightly\nmore vanilla in the sense that it can handle more cases.\n\nPerhaps the Makefile can be smarter about guessing the right path?\n\nSincerely,\nMichael Witten\n"},{"id":"78277","messageId":"vpqabi5o992.fsf@bauges.imag.fr","threadId":"13743","inReplyTo":"1212258886-87484-1-git-send-email-mfwitten@mit.edu","subject":"Re: [PATCH review] Build: make PERL_PATH = /usr/bin/env perl","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2008-06-01T08:22:01Z","receivedAt":"2008-06-01T08:22:01Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Michael Witten <mfwitten@MIT.EDU> writes:\n\n> [problem with different versions of perl]\n\nThere's also the case where perl simply isn't available in /usr/bin,\nbut is somewhere else.\n\n> It would seem to me that something like '/usr/bin/env perl' is slightly\n> more vanilla in the sense that it can handle more cases.\n>\n> Perhaps the Makefile can be smarter about guessing the right path?\n\nPerhaps something like this?\n\ndiff --git a/Makefile b/Makefile\nindex 865e2bf..5828745 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -323,7 +323,7 @@ ifndef SHELL_PATH\n \tSHELL_PATH = /bin/sh\n endif\n ifndef PERL_PATH\n-\tPERL_PATH = /usr/bin/perl\n+\tPERL_PATH = $(shell which perl)\n endif\n \n export PERL_PATH\n\n(untested)\n\nThis would generate the same files in the common case, but detect\nanother installation at compile time.\n\nNote that this is indeed different from the original proposal in the\ncase of a multi-user system: here, the perl installation is chosen\nonce and for all by the guy who installs git, but can't be overridden\nlater (e.g by a user having his own custom perl installation in his\n$HOME). I don't know which is better.\n\n\n-- \nMatthieu\n"},{"id":"78281","messageId":"7vej7hbkal.fsf@gitster.siamese.dyndns.org","threadId":"13743","inReplyTo":"vpqabi5o992.fsf@bauges.imag.fr","subject":"Re: [PATCH review] Build: make PERL_PATH = /usr/bin/env perl","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-06-01T09:01:54Z","receivedAt":"2008-06-01T09:01:54Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> Note that this is indeed different from the original proposal in the\n> case of a multi-user system: here, the perl installation is chosen\n> once and for all by the guy who installs git, but can't be overridden\n> later (e.g by a user having his own custom perl installation in his\n> $HOME). I don't know which is better.\n\n\"env\" is Ok to make the same scripts you have privately in your $HOME/bin/\n(which is mounted across different platforms) work with perl or python or\nwhatever from different places, but it is very unsuitable for scripts that\nare meant to be installed per machine, such as ours, for use by many\npeople.\n\nIf you do not have (or want to use) common programs at usual place, you\ntell \"make\" where they are, and the resulting scripts will use the same\nprogram for everybody.  That way, you don't have to worry about confusing\npeople by having scripts use different perl depending on who they are, and\nby failing for some people and working for others.\n\nYou _can_ use \"/usr/bin/env\" for your own build and I won't stop you, but\nplease don't tell me to ship such ugliness in the default Makefile.  We\nwill not do SHELL_PATH = $(shell which sh) either, ever.\n\nBy the way, \"which\" is probably Ok when you know there _is_ an instance of\nthe program somewhere on the $PATH, but be careful if you suspect there\nmight not be any.  Depending on whose \"which\" it is, it may not exit with\nnon-zero status nor be silent on the standard output.  If you are shooting\nfor portability, don't use it in your scripts, ever.  Also \"type\" is not\nmuch better either (\"type -p\" is a bash-ism).\n\nProbably the closest to the most portable would be \"command -v\"; this is a\nPOSIXly kosher way and seems to be Ok with /bin/ksh and OpenBSD /bin/sh as\nwell, not just bash and dash.\n"},{"id":"78295","messageId":"e06498070806011111w792399dfi9dad780ee00faa8a@mail.gmail.com","threadId":"13743","inReplyTo":"1212258886-87484-1-git-send-email-mfwitten@mit.edu","subject":"Re: [PATCH review] Build: make PERL_PATH = /usr/bin/env perl","fromName":"Steven Walter","fromEmail":"stevenrwalter@gmail.com","sentAt":"2008-06-01T18:11:08Z","receivedAt":"2008-06-01T18:11:08Z","isPatch":true,"sender":{"key":"stevenrwalter@gmail.com","avatar":"https://avatars.githubusercontent.com/u/79127?v=4"},"body":"On Sat, May 31, 2008 at 2:34 PM, Michael Witten <mfwitten@mit.edu> wrote:\n> This should make PERL_PATH more robust, as some\n> systems may have multiple version of perl installed.\n>\n> Signed-off-by: Michael Witten <mfwitten@mit.edu>\n> ---\n>  Makefile |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n>\n> diff --git a/Makefile b/Makefile\n> index 865e2bf..5828745 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -323,7 +323,7 @@ ifndef SHELL_PATH\n>        SHELL_PATH = /bin/sh\n>  endif\n>  ifndef PERL_PATH\n> -       PERL_PATH = /usr/bin/perl\n> +       PERL_PATH = /usr/bin/env perl\n>  endif\n>\n>  export PERL_PATH\n> --\n> 1.5.5.GIT\n\nIf you do this, you will have to modify the perl scripts to remove the\n-w flag from their hash-bang line.  \"/usr/bin/env perl -w\" does not\nseem to do the expected thing.\n-- \n-Steven Walter <stevenrwalter@gmail.com>\n\"A human being should be able to change a diaper, plan an invasion,\nbutcher a hog, conn a ship, design a building, write a sonnet, balance\naccounts, build a wall, set a bone, comfort the dying, take orders,\ngive orders, cooperate, act alone, solve equations, analyze a new\nproblem, pitch manure, program a computer, cook a tasty meal, fight\nefficiently, die gallantly. Specialization is for insects.\"\n -Robert Heinlein\n"},{"id":"78324","messageId":"84422837-A45A-4B33-9D25-8053477CD164@endpoint.com","threadId":"13743","inReplyTo":"e06498070806011111w792399dfi9dad780ee00faa8a@mail.gmail.com","subject":"Re: [PATCH review] Build: make PERL_PATH = /usr/bin/env perl","fromName":"David Christensen","fromEmail":"david@endpoint.com","sentAt":"2008-06-02T02:17:25Z","receivedAt":"2008-06-02T02:17:25Z","isPatch":true,"sender":{"key":"david@endpoint.com","avatar":"https://gravatar.com/avatar/6089b35cc409d9d15ab439753a213d7528cd5e0a04f3917fa452d8dc45296612?d=mp&s=160"},"body":"> If you do this, you will have to modify the perl scripts to remove the\n> -w flag from their hash-bang line.  \"/usr/bin/env perl -w\" does not\n> seem to do the expected thing.\n\nInsofar as compatibility is concerned, perl's -w flag is equivalent  \nto the 'use warnings' language pragma, which has been supported since  \n5.6 (circa 2000).  Seeing as perl's Unicode support did not really  \nmature until 5.8, I imagine that adding the 'use warnings' pragma and  \ndoing away with the -w flag would be a reasonable approach to take.\n\nRegards,\n\nDavid\n--\nDavid Christensen\nEnd Point Corporation\ndavid@endpoint.com\n"}]}