git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Todd Zullinger <tmz@pobox.com>
Cc: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Subject: Re: [PATCH] global: resolve Perl executable via PATH
Date: Wed, 5 Apr 2023 12:09:38 -0500	[thread overview]
Message-ID: <CAMP44s1V3nGnqCjoCi2xuH59APVPiAoQ82LQx3KNnsdDNfcoPg@mail.gmail.com> (raw)
In-Reply-To: <ZC2ZyTTZFbd_gNtw@pobox.com>

On Wed, Apr 5, 2023 at 11:31 AM Todd Zullinger <tmz@pobox.com> wrote:
>
> 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.

Generally the people interested in setting PERL_PATH are packagers,
and it's so the installed scripts have the desired hardcoded path.

So a script that is never installed isn't considered.

> > 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.]

It's better because it allows the user to choose another version
dynamically, for example:

    PATH=/opt/perl7/bin:$PATH script

> 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.

And as a user I would rather packagers don't treat me like a child.

I decide how to use *my* system.

And BTW, newer generations of developers use all kinds of version
managers like RVM and nvm, and perl has one as well: perlbrew [1]. Not
to mention docker, for which the Perl official image installs into
/usr/local/bin/perl.

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

So you can override '#!/usr/bin/env perl' instead of overriding
`#!/usr/bin/perl`, which the Git Makefile does by default anyway.

What's the difference to you?

> 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.

Arch Linux does whatever upstream does by default.

> I don't know how it may affects the Windows folks either, who are
> further askew from our other, more UNIX-like targets.

Windows doesn't use shebangs, you have to do `perl script`.

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

I don't think it matters to packagers how people developing Git run
the internal scripts.

Cheers.

[1] https://metacpan.org/pod/perlbrew

-- 
Felipe Contreras

  reply	other threads:[~2023-04-05 17:10 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05 10:10 [PATCH] global: resolve Perl executable via PATH Patrick Steinhardt
2023-04-05 13:35 ` Felipe Contreras
2023-04-05 14:48   ` Patrick Steinhardt
2023-04-05 14:42 ` Todd Zullinger
2023-04-05 14:52   ` Patrick Steinhardt
2023-04-05 15:54     ` Todd Zullinger
2023-04-05 17:09       ` Felipe Contreras [this message]
2023-04-05 17:35       ` Patrick Steinhardt
2023-04-05 18:44         ` Junio C Hamano
2023-04-06  2:27           ` Felipe Contreras
2023-04-05 16:54     ` Jeff King
2023-04-05 17:32       ` Patrick Steinhardt
2023-04-05 18:15         ` Jeff King
2023-04-06  2:18           ` Felipe Contreras
2023-04-06  3:35             ` Jeff King
2023-04-06  8:03               ` Ævar Arnfjörð Bjarmason
2023-04-18  8:59                 ` Felipe Contreras
2023-04-06  8:07           ` Patrick Steinhardt
2023-04-05 18:28 ` Kristoffer Haugsbakk
2023-04-05 21:30 ` Eric Wong
2023-04-06  2:16   ` Felipe Contreras
2023-04-06  8:05   ` Ævar Arnfjörð Bjarmason
2023-04-06  3:26 ` Jeff King
2023-04-06  8:19   ` Patrick Steinhardt
2023-04-06  9:36     ` [PATCH] t/lib-httpd: pass PERL_PATH to CGI scripts Jeff King
2023-04-06 16:34       ` Junio C Hamano
2023-04-18  9:04       ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMP44s1V3nGnqCjoCi2xuH59APVPiAoQ82LQx3KNnsdDNfcoPg@mail.gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=ps@pks.im \
    --cc=tmz@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).