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

Re: [PATCH] gitweb-lib.sh: Set up PATH to use perl from /usr/bin

From
Jeff King <peff@peff.net>
Date
May 1, 2012, 16:34 UTC
Message-ID
<20120501163420.GB15614@sigill.intra.peff.net>
In-Reply-To
<4FA00E09.2090708@in.waw.pl>
On Tue, May 01, 2012 at 06:23:37PM +0200, Zbigniew Jędrzejewski-Szmek wrote:
Show 8 quoted lines
> On 05/01/2012 01:23 PM, Torsten Bögershausen wrote:
> > When there are different version of perl installed on the machine,
> > the $PATH may point out a different version of perl than /usr/bin.
> > One example is to have /opt/local/bin/perl before /usr/bin/perl.
> > 
> > Sanitize the PATH by adding /usr/bin at the beginning
> Hm, I see that most scripts have #!/usr/bin/perl, and only two have
> #!env perl [1]. So in general we usally rely on using perl in /usr/bin.

The Makefile substitutes $PERL_PATH on the #!-line of each perl script during its "build" step (which is really just copying the file to its final name and running "chmod +x").

So even though the source files say /usr/bin/perl, we are not relying on that. If you look at the Makefile rule carefully, you will see that even "#!/usr/bin/env perl" gets replaced, too. Those scripts should probably be updated, since the mention of env is simply confusing.

> But your patch affects other stuff than perl, and unconditionally
> changing PATH set by the user is not nice, as it affect programs called
> recursively. Wouldn't simply replacing all calls to bare perl in
> t/gitweb-lib.sh with invocations of /usr/bin/perl be better?

Yes, although they should use $PERL_PATH rather than hardcoding /usr/bin.

-Peff
Previous: Zbigniew Jędrzejewski-SzmekNext: Junio C Hamano
Message 3 of 12 in “gitweb-lib.sh: Set up PATH to use perl from /usr/bin”
  1. gitweb-lib.sh: Set up PATH to use perl from /usr/binTorsten Bögershausen, May 1, 2012
  2. Zbigniew Jędrzejewski-SzmekMay 1, 2012
  3. Jeff KingMay 1, 2012
  4. Junio C HamanoMay 1, 2012
  5. Zbigniew Jędrzejewski-SzmekMay 1, 2012
  6. Jeff KingMay 1, 2012
  7. Torsten BögershausenMay 1, 2012
  8. Junio C HamanoMay 1, 2012
  9. t/gitweb-lib: use $PERL_PATH to run gitwebJeff King, May 1, 2012
  10. Consistently use perl from /usr/bin/ for scriptsZbigniew Jędrzejewski-Szmek, May 1, 2012
  11. Randal L. SchwartzMay 1, 2012
  12. Junio C HamanoMay 1, 2012

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.