* [PATCH review] Build: make PERL_PATH = /usr/bin/env perl
@ 2008-05-31 18:34 Michael Witten
2008-05-31 19:55 ` Junio C Hamano
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Michael Witten @ 2008-05-31 18:34 UTC (permalink / raw)
To: git; +Cc: Michael Witten
This should make PERL_PATH more robust, as some
systems may have multiple version of perl installed.
Signed-off-by: Michael Witten <mfwitten@mit.edu>
---
Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 865e2bf..5828745 100644
--- a/Makefile
+++ b/Makefile
@@ -323,7 +323,7 @@ ifndef SHELL_PATH
SHELL_PATH = /bin/sh
endif
ifndef PERL_PATH
- PERL_PATH = /usr/bin/perl
+ PERL_PATH = /usr/bin/env perl
endif
export PERL_PATH
--
1.5.5.GIT
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH review] Build: make PERL_PATH = /usr/bin/env perl 2008-05-31 18:34 [PATCH review] Build: make PERL_PATH = /usr/bin/env perl Michael Witten @ 2008-05-31 19:55 ` Junio C Hamano 2008-06-01 4:48 ` Michael Witten 2008-06-01 8:22 ` Matthieu Moy 2008-06-01 18:11 ` Steven Walter 2 siblings, 1 reply; 7+ messages in thread From: Junio C Hamano @ 2008-05-31 19:55 UTC (permalink / raw) To: Michael Witten; +Cc: git Michael Witten <mfwitten@MIT.EDU> writes: > This should make PERL_PATH more robust, as some > systems may have multiple version of perl installed. > > Signed-off-by: Michael Witten <mfwitten@mit.edu> > --- > Makefile | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/Makefile b/Makefile > index 865e2bf..5828745 100644 > --- a/Makefile > +++ b/Makefile > @@ -323,7 +323,7 @@ ifndef SHELL_PATH > SHELL_PATH = /bin/sh > endif > ifndef PERL_PATH > - PERL_PATH = /usr/bin/perl > + PERL_PATH = /usr/bin/env perl > endif > > export PERL_PATH If you insist, you can do so from your "make" command line, but I'd prefer the default configuration as vanilla as possible. I notice that both git-svn.perl and git-relink.perl begin with "#!/usr/bin/env perl", and I think that is a mistake. The #! line is rewritten by Makefile, and there is no reason to write a "/usr/bin/env" ugliness there in the source. Not that it hurts, as it is blown away when Makefile rewrites it to "#!$(PERL_PATH)", but it still looks ugly. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH review] Build: make PERL_PATH = /usr/bin/env perl 2008-05-31 19:55 ` Junio C Hamano @ 2008-06-01 4:48 ` Michael Witten 0 siblings, 0 replies; 7+ messages in thread From: Michael Witten @ 2008-06-01 4:48 UTC (permalink / raw) To: git; +Cc: Junio C Hamano On 31 May 2008, at 3:55 PM, Junio C Hamano wrote: > If you insist, you can do so from your "make" command line, but I'd > prefer > the default configuration as vanilla as possible. The main trouble I've run into is with multiple versions of perl installed. For instance, it is unadvisable to overwrite the Mac OS X provided perl distribution. Consequently, custom installations are usually put into /usr/local (also, MacPorts install everything into /opt/local). This means that a 'vanilla' configuration may not (most likely will not) make use of the perl distribution that is actually employed by the user. This matters, because some tools like git-send-email require extra CPAN modules such as Net::SMTP::SSL, which won't be found unless git has been configured with a custom PERL_PATH. It would seem to me that something like '/usr/bin/env perl' is slightly more vanilla in the sense that it can handle more cases. Perhaps the Makefile can be smarter about guessing the right path? Sincerely, Michael Witten ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH review] Build: make PERL_PATH = /usr/bin/env perl 2008-05-31 18:34 [PATCH review] Build: make PERL_PATH = /usr/bin/env perl Michael Witten 2008-05-31 19:55 ` Junio C Hamano @ 2008-06-01 8:22 ` Matthieu Moy 2008-06-01 9:01 ` Junio C Hamano 2008-06-01 18:11 ` Steven Walter 2 siblings, 1 reply; 7+ messages in thread From: Matthieu Moy @ 2008-06-01 8:22 UTC (permalink / raw) To: Michael Witten; +Cc: git Michael Witten <mfwitten@MIT.EDU> writes: > [problem with different versions of perl] There's also the case where perl simply isn't available in /usr/bin, but is somewhere else. > It would seem to me that something like '/usr/bin/env perl' is slightly > more vanilla in the sense that it can handle more cases. > > Perhaps the Makefile can be smarter about guessing the right path? Perhaps something like this? diff --git a/Makefile b/Makefile index 865e2bf..5828745 100644 --- a/Makefile +++ b/Makefile @@ -323,7 +323,7 @@ ifndef SHELL_PATH SHELL_PATH = /bin/sh endif ifndef PERL_PATH - PERL_PATH = /usr/bin/perl + PERL_PATH = $(shell which perl) endif export PERL_PATH (untested) This would generate the same files in the common case, but detect another installation at compile time. Note that this is indeed different from the original proposal in the case of a multi-user system: here, the perl installation is chosen once and for all by the guy who installs git, but can't be overridden later (e.g by a user having his own custom perl installation in his $HOME). I don't know which is better. -- Matthieu ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH review] Build: make PERL_PATH = /usr/bin/env perl 2008-06-01 8:22 ` Matthieu Moy @ 2008-06-01 9:01 ` Junio C Hamano 0 siblings, 0 replies; 7+ messages in thread From: Junio C Hamano @ 2008-06-01 9:01 UTC (permalink / raw) To: Matthieu Moy; +Cc: Michael Witten, git Matthieu Moy <Matthieu.Moy@imag.fr> writes: > Note that this is indeed different from the original proposal in the > case of a multi-user system: here, the perl installation is chosen > once and for all by the guy who installs git, but can't be overridden > later (e.g by a user having his own custom perl installation in his > $HOME). I don't know which is better. "env" is Ok to make the same scripts you have privately in your $HOME/bin/ (which is mounted across different platforms) work with perl or python or whatever from different places, but it is very unsuitable for scripts that are meant to be installed per machine, such as ours, for use by many people. If you do not have (or want to use) common programs at usual place, you tell "make" where they are, and the resulting scripts will use the same program for everybody. That way, you don't have to worry about confusing people by having scripts use different perl depending on who they are, and by failing for some people and working for others. You _can_ use "/usr/bin/env" for your own build and I won't stop you, but please don't tell me to ship such ugliness in the default Makefile. We will not do SHELL_PATH = $(shell which sh) either, ever. By the way, "which" is probably Ok when you know there _is_ an instance of the program somewhere on the $PATH, but be careful if you suspect there might not be any. Depending on whose "which" it is, it may not exit with non-zero status nor be silent on the standard output. If you are shooting for portability, don't use it in your scripts, ever. Also "type" is not much better either ("type -p" is a bash-ism). Probably the closest to the most portable would be "command -v"; this is a POSIXly kosher way and seems to be Ok with /bin/ksh and OpenBSD /bin/sh as well, not just bash and dash. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH review] Build: make PERL_PATH = /usr/bin/env perl 2008-05-31 18:34 [PATCH review] Build: make PERL_PATH = /usr/bin/env perl Michael Witten 2008-05-31 19:55 ` Junio C Hamano 2008-06-01 8:22 ` Matthieu Moy @ 2008-06-01 18:11 ` Steven Walter 2008-06-02 2:17 ` David Christensen 2 siblings, 1 reply; 7+ messages in thread From: Steven Walter @ 2008-06-01 18:11 UTC (permalink / raw) To: Michael Witten; +Cc: git On Sat, May 31, 2008 at 2:34 PM, Michael Witten <mfwitten@mit.edu> wrote: > This should make PERL_PATH more robust, as some > systems may have multiple version of perl installed. > > Signed-off-by: Michael Witten <mfwitten@mit.edu> > --- > Makefile | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/Makefile b/Makefile > index 865e2bf..5828745 100644 > --- a/Makefile > +++ b/Makefile > @@ -323,7 +323,7 @@ ifndef SHELL_PATH > SHELL_PATH = /bin/sh > endif > ifndef PERL_PATH > - PERL_PATH = /usr/bin/perl > + PERL_PATH = /usr/bin/env perl > endif > > export PERL_PATH > -- > 1.5.5.GIT If you do this, you will have to modify the perl scripts to remove the -w flag from their hash-bang line. "/usr/bin/env perl -w" does not seem to do the expected thing. -- -Steven Walter <stevenrwalter@gmail.com> "A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects." -Robert Heinlein ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH review] Build: make PERL_PATH = /usr/bin/env perl 2008-06-01 18:11 ` Steven Walter @ 2008-06-02 2:17 ` David Christensen 0 siblings, 0 replies; 7+ messages in thread From: David Christensen @ 2008-06-02 2:17 UTC (permalink / raw) To: Steven Walter; +Cc: Michael Witten, git > If you do this, you will have to modify the perl scripts to remove the > -w flag from their hash-bang line. "/usr/bin/env perl -w" does not > seem to do the expected thing. Insofar as compatibility is concerned, perl's -w flag is equivalent to the 'use warnings' language pragma, which has been supported since 5.6 (circa 2000). Seeing as perl's Unicode support did not really mature until 5.8, I imagine that adding the 'use warnings' pragma and doing away with the -w flag would be a reasonable approach to take. Regards, David -- David Christensen End Point Corporation david@endpoint.com ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-06-02 2:37 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-05-31 18:34 [PATCH review] Build: make PERL_PATH = /usr/bin/env perl Michael Witten 2008-05-31 19:55 ` Junio C Hamano 2008-06-01 4:48 ` Michael Witten 2008-06-01 8:22 ` Matthieu Moy 2008-06-01 9:01 ` Junio C Hamano 2008-06-01 18:11 ` Steven Walter 2008-06-02 2:17 ` David Christensen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox