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

Re: [PATCH] global: resolve Perl executable via PATH

From
Patrick Steinhardt <ps@pks.im>
Date
Apr 5, 2023, 17:32 UTC
Message-ID
<ZC2wppC62E7wOcqM@xps>
In-Reply-To
<20230405165414.GA497301@coredump.intra.peff.net>
On Wed, Apr 05, 2023 at 12:54:14PM -0400, Jeff King wrote:
Show 49 quoted lines
> On Wed, Apr 05, 2023 at 04:52:40PM +0200, Patrick Steinhardt wrote:
> 
> > > Is there a reason to not set PERL_PATH, which is the
> > > documented method to handle this?  From the Makefike:
> > > 
> > > # Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl).
> > 
> > Setting PERL_PATH helps with a subset of invocations where the Makefile
> > either executes Perl directly or where it writes the shebang itself. But
> > the majority of scripts I'm touching have `#!/usr/bin/perl` as shebang,
> > and that path is not adjusted by setting PERL_PATH.
> 
> Which scripts? If I do:
> 
>   mkdir /tmp/foo
>   ln -s /usr/bin/perl /tmp/foo/my-perl
>   make PERL_PATH=/tmp/foo/my-perl prefix=/tmp/foo install
> 
>   head -n 1 /tmp/foo/bin/git-cvsserver
> 
> Then I see:
> 
>   #!/tmp/foo/my-perl
> 
> And that is due to this segment in the Makefile:
> 
>   $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE
>           $(QUIET_GEN) \
>           sed -e '1{' \
>               -e '        s|#!.*perl|#!$(PERL_PATH_SQ)|' \
>               -e '        r GIT-PERL-HEADER' \
>               -e '        G' \
>               -e '}' \
>               -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
>               $< >$@+ && \
>           chmod +x $@+ && \
>           mv $@+ $@
> 
> And that behavior goes all the way back to bc6146d2abc ('build' scripts
> before installing., 2005-09-08). If there are some perl scripts we are
> "building" outside of this rule, then that is probably a bug.
> 
> The only thing I found via:
> 
>   find /tmp/foo -type | xargs grep /usr/bin/perl
> 
> was a sample hook (which is probably a bug; we do munge the hook scripts
> to replace @PERL_PATH@, etc, but I think the Makefile never learned that
> the template hook scripts might be something other than shell scripts).

Yeah, agreed, the scripts we install are fine from all I can tell. I should've clarified, but what I care about is our build infra as well as our test scripts. That's neither clear from the commit description nor from the changes that I'm doing.

I'd be happy to keep the current state of installed scripts as-is and resend another iteration of this patch that only addresses shebangs used in internal scripts.

Patrick
Previous: Jeff KingNext: Jeff King
Message 12 of 27 in “global: resolve Perl executable via PATH”
  1. global: resolve Perl executable via PATHPatrick Steinhardt, Apr 5, 2023
  2. Felipe ContrerasApr 5, 2023
  3. Patrick SteinhardtApr 5, 2023
  4. Todd ZullingerApr 5, 2023
  5. Patrick SteinhardtApr 5, 2023
  6. Todd ZullingerApr 5, 2023
  7. Felipe ContrerasApr 5, 2023
  8. Patrick SteinhardtApr 5, 2023
  9. Junio C HamanoApr 5, 2023
  10. Felipe ContrerasApr 6, 2023
  11. Jeff KingApr 5, 2023
  12. Patrick SteinhardtApr 5, 2023
  13. Jeff KingApr 5, 2023
  14. Felipe ContrerasApr 6, 2023
  15. Jeff KingApr 6, 2023
  16. Ævar Arnfjörð BjarmasonApr 6, 2023
  17. Felipe ContrerasApr 18, 2023
  18. Patrick SteinhardtApr 6, 2023
  19. Kristoffer HaugsbakkApr 5, 2023
  20. Eric WongApr 5, 2023
  21. Felipe ContrerasApr 6, 2023
  22. Ævar Arnfjörð BjarmasonApr 6, 2023
  23. Jeff KingApr 6, 2023
  24. Patrick SteinhardtApr 6, 2023
  25. t/lib-httpd: pass PERL_PATH to CGI scriptsJeff King, Apr 6, 2023
  26. Junio C HamanoApr 6, 2023
  27. Felipe ContrerasApr 18, 2023

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.