Skip to contentSkip to conversation

Use SHELL_PATH as hash bang in test suite askpass helper script.

PATCH In review Ben Walton 3 participants 5 messages Jun 15, 2016

lore
Share & tools
lore

Ben Walton

author
#0 lore raw

PATCH 1/1 Use SHELL_PATH as hash bang in test suite askpass helper script.

The askpass script that is created for use by the test suite should use SHELL_PATH for its hash bang instead of /bin/sh. Commit 5a4352024 introduced the use of idioms not supported in some legacy /bin/sh implementations.

---
 t/lib-credential.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
t/lib-credential.sh +2 -2
index 9e7d796..ca4a6de 100755
@@ -278,8 +278,8 @@ helper_test_timeout() {
 	'
 }
 
-cat >askpass <<\EOF
-#!/bin/sh
+echo "#!$SHELL_PATH" >askpass
+cat >>askpass <<\EOF
 echo >&2 askpass: $*
 what=$(echo $1 | cut -d" " -f1 | tr A-Z a-z | tr -cd a-z)
 echo "askpass-$what"
Signature · 1 line
1.9.1
#1 lore raw
Quoted 4 lines · Ben Walton

The askpass script that is created for use by the test suite should use SHELL_PATH for its hash bang instead of /bin/sh. Commit 5a4352024 introduced the use of idioms not supported in some legacy /bin/sh implementations.

Sounds good.

t/lib-credential.sh helper_test_timeout() { · line 282

Quoted 4 lines
t/lib-credential.sh +2 -2
-cat >askpass <<\EOF
-#!/bin/sh
+echo "#!$SHELL_PATH" >askpass
+cat >>askpass <<\EOF

This can just become:

write_script askpass <<\EOF

which handles this for us (and you can get rid of the manual chmod then, too).

-Peff

author
#2 lore raw

PATCH 1/1 Ensure SHELL_PATH is the hash bang for test suite askpass helper script.

The askpass script that is created for use by the test suite should use SHELL_PATH for its hash bang instead of /bin/sh. Commit 5a4352024 introduced the use of idioms not supported in some legacy /bin/sh implementations.

Use write_script to ensure this happens automatically. This lets us remove the chmod step as well, since write_script handles that.

---
 t/lib-credential.sh | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
t/lib-credential.sh +1 -3
index 9e7d796..d8e41f7 100755
@@ -278,12 +278,10 @@ helper_test_timeout() {
 	'
 }
 
-cat >askpass <<\EOF
-#!/bin/sh
+write_script askpass <<\EOF
 echo >&2 askpass: $*
 what=$(echo $1 | cut -d" " -f1 | tr A-Z a-z | tr -cd a-z)
 echo "askpass-$what"
 EOF
-chmod +x askpass
 GIT_ASKPASS="$PWD/askpass"
 export GIT_ASKPASS
Signature · 1 line
1.9.1
#3 lore raw

Re: [PATCH] Ensure SHELL_PATH is the hash bang for test suite askpass helper script.

Quoted 9 lines · Ben Walton

The askpass script that is created for use by the test suite should use SHELL_PATH for its hash bang instead of /bin/sh. Commit 5a4352024 introduced the use of idioms not supported in some legacy /bin/sh implementations.

Use write_script to ensure this happens automatically. This lets us remove the chmod step as well, since write_script handles that.

Thanks, this looks good to me.

-Peff

#4 lore raw

Re: [PATCH] Ensure SHELL_PATH is the hash bang for test suite askpass helper script.

In reply to Ben Walton
Quoted 10 lines · Ben Walton

The askpass script that is created for use by the test suite should use SHELL_PATH for its hash bang instead of /bin/sh. Commit 5a4352024 introduced the use of idioms not supported in some legacy /bin/sh implementations.

Use write_script to ensure this happens automatically. This lets us remove the chmod step as well, since write_script handles that.

---

I'll leave out the "some legacy shells we do not support want to use command" from the justification of this change. Use of the write_script helper is the right thing to do---$SHELL_PATH points at the shell the user told us s/he wants to use, and that is a reason enough for this change. The reason why the user wants to use that shell is immaterial.

Thanks.

Quoted 21 lines
 t/lib-credential.sh | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
t/lib-credential.sh +1 -3
index 9e7d796..d8e41f7 100755
@@ -278,12 +278,10 @@ helper_test_timeout() {
 	'
 }
 
-cat >askpass <<\EOF
-#!/bin/sh
+write_script askpass <<\EOF
 echo >&2 askpass: $*
 what=$(echo $1 | cut -d" " -f1 | tr A-Z a-z | tr -cd a-z)
 echo "askpass-$what"
 EOF
-chmod +x askpass
 GIT_ASKPASS="$PWD/askpass"
 export GIT_ASKPASS