git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Patrick Steinhardt <ps@pks.im>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: [PATCH] t/lib-httpd: pass PERL_PATH to CGI scripts
Date: Thu, 6 Apr 2023 05:36:02 -0400	[thread overview]
Message-ID: <20230406093602.GD2215039@coredump.intra.peff.net> (raw)
In-Reply-To: <ZC6AdylF4TI41vnX@ncase>

On Thu, Apr 06, 2023 at 10:19:03AM +0200, Patrick Steinhardt wrote:

> > Does this fix the cases you saw, or are there others?
> 
> You know, let's just go with your patch. With PERL_PATH set it fixes all
> the issues I have observed. At some point in time I saw more issues than
> the one you fix here, but that's because my `config.mak` got lost
> without me noticing. Oops, embarassing.

OK, that is good if there is nothing left to fix. :) Let us know if any
of the others pop up again.

I also built the docs, which seems to use PERL_PATH as appropriate,
though one thing that did trip me up is that:

  make PERL_PATH=/my/actual/perl
  cd Documentation
  make

does not pick up the earlier PERL_PATH. Which is not surprising if you
think about it. It's just that we shove some knobs into
GIT-BUILD-OPTIONS and then pick them out later (but only in shell
scripts, not in the Makefile), which created a false expectation.

> > Subject: [PATCH] t/lib-httpd: pass PERL_PATH to CGI scripts

Reposting verbatim with a Cc and a catchier subject to get the
maintainer's attention.

-- >8 --
Subject: t/lib-httpd: pass PERL_PATH to CGI scripts

As discussed in t/README, tests should aim to use PERL_PATH rather than
straight "perl". We usually do this automatically with a "perl" function
in test-lib.sh, but a few cases need to be handled specially.

One such case is the apply-one-time-perl.sh CGI, which invokes plain
"perl". It should be using $PERL_PATH, but to make that work, we must
also instruct Apache to pass through the variable.

Prior to this patch, doing:

  mv /usr/bin/perl /usr/bin/my-perl
  make PERL_PATH=/usr/bin/my-perl test

would fail t5702, t5703, and t5616. After this it passes. This is a
pretty extreme case, as even if you install perl elsewhere, you'd likely
still have it in your $PATH. A more realistic case is that you don't
want to use the perl in your $PATH (because it's older, broken, etc) and
expect PERL_PATH to consistently override that (since that's what it's
documented to do). Removing it completely is just a convenient way of
completely breaking it for testing purposes.

Signed-off-by: Jeff King <peff@peff.net>
---
 t/lib-httpd/apache.conf            | 2 ++
 t/lib-httpd/apply-one-time-perl.sh | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index f43a25c1f10..9e6892970de 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -101,6 +101,8 @@ PassEnv LC_ALL
 Alias /dumb/ www/
 Alias /auth/dumb/ www/auth/dumb/
 
+SetEnv PERL_PATH ${PERL_PATH}
+
 <LocationMatch /smart/>
 	SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
 	SetEnv GIT_HTTP_EXPORT_ALL
diff --git a/t/lib-httpd/apply-one-time-perl.sh b/t/lib-httpd/apply-one-time-perl.sh
index 09a0abdff7c..d7f9fed6aee 100644
--- a/t/lib-httpd/apply-one-time-perl.sh
+++ b/t/lib-httpd/apply-one-time-perl.sh
@@ -13,7 +13,7 @@ then
 	export LC_ALL
 
 	"$GIT_EXEC_PATH/git-http-backend" >out
-	perl -pe "$(cat one-time-perl)" out >out_modified
+	"$PERL_PATH" -pe "$(cat one-time-perl)" out >out_modified
 
 	if cmp -s out out_modified
 	then
-- 
2.40.0.824.g7b678b1f643


  reply	other threads:[~2023-04-06  9:36 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
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     ` Jeff King [this message]
2023-04-06 16:34       ` [PATCH] t/lib-httpd: pass PERL_PATH to CGI scripts 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=20230406093602.GD2215039@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ps@pks.im \
    /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).