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

Re: [PATCH] gitweb-lib.sh: Set up PATH to use perl from /usr/bin

From
Jeff King <peff@peff.net>
Date
May 1, 2012, 17:08 UTC
Message-ID
<20120501170810.GA22444@sigill.intra.peff.net>
In-Reply-To
<4FA0176B.50300@in.waw.pl>
On Tue, May 01, 2012 at 07:03:39PM +0200, Zbigniew Jędrzejewski-Szmek wrote:
Show 8 quoted lines
> But I don't see why we would use a different perl in
> git-am.sh:                      perl -ne 'BEGIN { $subject = 0 }
> git-am.sh:                      perl -M'POSIX qw(strftime)' -ne 'BEGIN { $subject = 0 }
> git-request-pull.sh:ref=$(git ls-remote "$url" | perl -e "$find_matching_ref" "$head" "$headrev")
> git-submodule.sh:       perl -e '
> test-sha1.sh:                   perl -pe 'y/\000/g/'
> test-sha1.sh:                   perl -pe 'y/\000/g/'
> and lot of files in t/. Shouldn't those be replaced too?
No. There are two ways in which we use perl:
  1. To run our complex scripts like gitweb, git-svn, etc. These require
     a reasonably modern perl version, and the user must specify it with
     PERL_PATH if it is not in /usr/bin.
  2. To run little snippets that _could_ be written in sed or awk, but
     which cause portability problems on crappy versions of those tools.
     These should run under any version of perl5.

It's OK to use 'perl' from the path for (2), because we are not asking very much of perl in that case.

I think the patch we want is just:
diff --git a/t/gitweb-lib.sh b/t/gitweb-lib.sh
index 21d11d6..ae2dc46 100644
--- a/t/gitweb-lib.sh
+++ b/t/gitweb-lib.sh
@@ -69,7 +69,7 @@ gitweb_run () {
 	# written to web server logs, so we are not interested in that:
 	# we are interested only in properly formatted errors/warnings
 	rm -f gitweb.log &&
-	perl -- "$SCRIPT_NAME" \
+	"$PERL_PATH" -- "$SCRIPT_NAME" \
 		>gitweb.output 2>gitweb.log &&
 	perl -w -e '
 		open O, ">gitweb.headers";

no? Torsten, does that fix your problem?

-Peff
Previous: Zbigniew Jędrzejewski-SzmekNext: Torsten Bögershausen
Message 6 of 12 in “gitweb-lib.sh: Set up PATH to use perl from /usr/bin”
  1. gitweb-lib.sh: Set up PATH to use perl from /usr/binTorsten Bögershausen, May 1, 2012
  2. Zbigniew Jędrzejewski-SzmekMay 1, 2012
  3. Jeff KingMay 1, 2012
  4. Junio C HamanoMay 1, 2012
  5. Zbigniew Jędrzejewski-SzmekMay 1, 2012
  6. Jeff KingMay 1, 2012
  7. Torsten BögershausenMay 1, 2012
  8. Junio C HamanoMay 1, 2012
  9. t/gitweb-lib: use $PERL_PATH to run gitwebJeff King, May 1, 2012
  10. Consistently use perl from /usr/bin/ for scriptsZbigniew Jędrzejewski-Szmek, May 1, 2012
  11. Randal L. SchwartzMay 1, 2012
  12. Junio C HamanoMay 1, 2012

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.