From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Felipe Contreras <felipe.contreras@gmail.com>,
Patrick Steinhardt <ps@pks.im>, Todd Zullinger <tmz@pobox.com>,
git@vger.kernel.org
Subject: Re: [PATCH] global: resolve Perl executable via PATH
Date: Thu, 06 Apr 2023 10:03:53 +0200 [thread overview]
Message-ID: <230406.86y1n5tnvk.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <20230406033507.GA2092122@coredump.intra.peff.net>
On Wed, Apr 05 2023, Jeff King wrote:
> On Wed, Apr 05, 2023 at 09:18:20PM -0500, Felipe Contreras wrote:
>
>> On Wed, Apr 5, 2023 at 2:09 PM Jeff King <peff@peff.net> wrote:
>> > On Wed, Apr 05, 2023 at 07:32:22PM +0200, Patrick Steinhardt wrote:
>>
>> > IMHO we should aim for fixing those inconsistencies, and then letting
>> > people set PERL_PATH as appropriate (even to something that will find it
>> > via $PATH if they want to).
>>
>> We can aim to fix all those inconsistencies *eventually* while in the
>> meantime make them runnable for most people *today*.
>>
>> It's not a dichotomy.
>
> It is if the proposed patches change the behavior in such a way as to
> make things less consistent.
>
> There are three plausible perls to run (whether intentionally or
> accidentally):
>
> 1. the one in PERL_PATH
>
> 2. /usr/bin/perl
>
> 3. the first one in $PATH
>
> What the code tries to do now is to consistently use (1). If there are
> cases that accidentally use (2), which is what I took Patrick's patch to
> mean, then that is a problem for people who set PERL_PATH to something
> else, but not for people who leave it as /usr/bin/perl. If we "fix"
> those cases by switching them to (3), then now things are less
> consistent for such people than when we started.
>
> But I am not clear on what those cases are (if any), and we have not
> seen Patrick's follow-up proposed patch.
>
> I did find one case that is accidentally doing (3), and posted a patch
> elsewhere in the thread to convert it to (1). If you prefer behavior
> (3), you might consider that a regression, but it seems meaningless
> given the 99% of other cases that are using (1). If you want (3) to be
> the behavior everywhere, then we'd need to completely change our stance
> on how we invoke perl, or we need to teach PERL_PATH to handle this case
> so that people building Git can choose their own preference (sadly I
> don't think "make PERL_PATH='/usr/bin/env perl'" quite works because we
> have to shell-quote it in some contexts before evaluating).
I just want to chime in to say that I've read this whole
thread-at-large, and I think what you're pointing out here is correct,
and that we should keep hardcoding "#!/usr/bin/perl", and then just have
"PERL_PATH" set.
I.e. most of Patrick's original patch is unnecessary, as we either use
"$PERL_PATH" in the Makefile already, or munge the shebang when we
install.
Then the only change we should need is the one you suggested in
<20230406032647.GA2092142@coredump.intra.peff.net> in the side-thread.
Using "env" liket his is also incorrect. I might have a "perl" in my
"$PATH" which I expect to use for e.g. by .bashrc, but I don't want that
perl to take priority over "$PERL_PATH" for git when I run some test
script.
I also wonder if something like this (untested) wouldn't be useful to
provide an earlier warning of this, instead of failing when we fail to
invoke the relevant scripts.
diff --git a/Makefile b/Makefile
index 60ab1a8b4f4..9abc2e52cfa 100644
--- a/Makefile
+++ b/Makefile
@@ -910,6 +910,15 @@ ifndef PYTHON_PATH
PYTHON_PATH = /usr/bin/python
endif
+define check-path-exists
+ifeq ($$(wildcard $$($(1))),)
+$$(error $(1) set to '$(2)', which does not exist)
+endif
+endef
+
+$(eval $(call check-path-exists,SHELL_PATH,$(SHELL_PATH)))
+$(eval $(call check-path-exists,PERL_PATH,$(PERL_PATH)))
+
export PERL_PATH
export PYTHON_PATH
That should not break anything in principle, as we already rely on these
to build git itself, but note that that's not the case with
"PYTHON_PATH".
In the case of "PERL_PATH" I think that's limited to building the docs,
so if we did something like this perhaps it should be in shared.mak, and
that check should be in Documentation/Makefile.
But perhaps it's all reduntant to just running into an error when we try
to generate-cmdlist.sh or whatever...
next prev parent reply other threads:[~2023-04-06 8:30 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
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 [this message]
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=230406.86y1n5tnvk.gmgdl@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=felipe.contreras@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
--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).