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

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

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 6, 2023, 02:27 UTC
Message-ID
<CAMP44s2VuvP_mhLSXXyC1__GGYhfQM4Td-bghOE3AmqfQW0Czw@mail.gmail.com>
In-Reply-To
<xmqqv8iaw4n5.fsf@gitster.g>
On Wed, Apr 5, 2023 at 2:29 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 21 quoted lines
>
> Patrick Steinhardt <ps@pks.im> writes:
>
> >> I don't know what the right choice is for upstream Git, it
> >> can easily be argued in either direction. :)
> >
> > I agree, there is no clearly-superior choice -- both have their merits.
> > I'll probably send a v2 that only munges internal scripts that are used
> > as part of our build and testing infrastructure. That's the area I care
> > most about in this context anyway.
>
> My preference is
>
>  (1) not to touch scripts that are processed by Makefile to use
>      $PERL_PATH,
>
>  (2) fix callers of "./foo.pl" to invoke "$PERL_PATH ./foo.pl" where
>      the perl () { command "$PERL_PATH" "$@" } wrapper is not
>      avialable, and
>
>  (3) fix them to use "perl foo.pl" where the wrapper is visible.
That is orthogonal to the patch.

All those steps can be done *eventually* while the proposed patch is applied *today*.

> That way, we can wean ourselves away from the assumption that perl
> interpreter should exist at /usr/bin/perl without introducing a new
> assumption that everybody's env should exist at /usr/bin/env.
The patch doesn't introduce such an assumption.

Changing the shebang only affects scripts that are 1) not processed by the Makefile, and 2) not called as "${PERL_PATH-perl} foo.pl".

If your system does not have /usr/bin/env and everything you cared about worked yesterday, it would still work with the patch applied today.

Having a `#!/usr/bin/env perl` shebang is simply a good practice to write in all scripts.

But that is just the *default*, nobody is being forced to actually use that shebang because 1) the Makefile is still going to override that and replace it with $PERL_PATH in generated scripts, and 2) the scripts that do "$PERL_PATH ./foo.pl" are essentially overriding it to, and so does 3).

I believe this is a red herring (which might be desirable to fix some day).
Cheers.
-- 
Felipe Contreras
Previous: Junio C HamanoNext: Jeff King
Message 10 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.