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

From: Todd Zullinger <[email-masked]>
Date: Wed, 5 Apr 2023 11:54:49 -0400

Patrick Steinhardt wrote:
> On Wed, Apr 05, 2023 at 10:42:52AM -0400, Todd Zullinger 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.

Ahh.  I wonder if that's intentional?  I haven't dug into
the history, so I'm not sure.  It seems like an oversight,
as an initial reaction.

> I'd be happy to amend the patch series to only fix up shebangs which
> would not be helped by setting PERL_PATH. But if we can make it work
> without having to set PERL_PATH at all I don't quite see the point.

It's certainly debatable whether using /path/to/env perl is
better than hard-coding it at build time (forgetting about
the usage of RUNTIME_PREFIX). [Debatable in a friendly
sense, of course.]

As a distribution packager, I prefer to set the path at
build time to help ensure that an end user can't easily
break things by installing a different perl in PATH.

The Fedora build system will munge /path/to/env perl
shebangs to /usr/bin/perl and it won't effect us much.

That may not be true for other distributions and they may
care more if they want to keep using a hard-coded path to
perl.  I don't know how it may affects the Windows folks
either, who are further askew from our other, more UNIX-like
targets.

I don't know what the right choice is for upstream Git, it
can easily be argued in either direction. :)

Cheers,

-- 
Todd