Skip to content

Commit c191715

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7556e5d commit c191715

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

t/lib-httpd/apache.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ PassEnv LC_ALL
8686
Alias /dumb/ www/
8787
Alias /auth/dumb/ www/auth/dumb/
8888

89+
SetEnv PERL_PATH ${PERL_PATH}
90+
8991
<LocationMatch /smart/>
9092
SetEnv GIT_EXEC_PATH ${GIT_EXEC_PATH}
9193
SetEnv GIT_HTTP_EXPORT_ALL

t/lib-httpd/apply-one-time-perl.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ then
1313
export LC_ALL
1414

1515
"$GIT_EXEC_PATH/git-http-backend" >out
16-
perl -pe "$(cat one-time-perl)" out >out_modified
16+
"$PERL_PATH" -pe "$(cat one-time-perl)" out >out_modified
1717

1818
if cmp -s out out_modified
1919
then

0 commit comments

Comments
 (0)