git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH review] Build: make PERL_PATH = /usr/bin/env perl

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 1, 2008, 09:01 UTC
Message-ID
<7vej7hbkal.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<vpqabi5o992.fsf@bauges.imag.fr>
Matthieu Moy <Matthieu.Moy@imag.fr> writes:
Show 5 quoted lines
> 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.

Previous: Matthieu MoyNext: Steven Walter
Message 5 of 7 in “Build: make PERL_PATH = /usr/bin/env perl”
  1. Build: make PERL_PATH = /usr/bin/env perlMichael Witten, May 31, 2008
  2. Junio C HamanoMay 31, 2008
  3. Michael WittenJun 1, 2008
  4. Matthieu MoyJun 1, 2008
  5. Junio C HamanoJun 1, 2008
  6. Steven WalterJun 1, 2008
  7. David ChristensenJun 2, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.