Thread (5 messages) flat view 5 messages, 4 authors, 2016-06-15

Re: [PATCH] t0300-credentials: Word around a solaris /bin/sh bug

From: Jeff King <hidden>
Date: 2016-06-15 22:52:55
Subsystem: the rest · Maintainer: Linus Torvalds

On Thu, Feb 02, 2012 at 02:32:15PM -0500, Ben Walton wrote:
Solaris' /bin/sh was making the IFS setting permanent instead of
temporary when using it to slurp in credentials in the generated
'dump' script of the 'setup helper scripts' test in t0300-credentials.
Hmm. Presumably you are setting SHELL_PATH, as Solaris /bin/sh would be
useless for running the rest of the tests. Usually scripts inside the
tests use #!$SHELL_PATH, but I often don't bother if it's a simple "even
Solaris /bin/sh could run this" script. But in this case I either
underestimated the complexity of my script or overestimated the quality
of the Solaris /bin/sh.

I wonder if a better solution is to use a known-good shell instead of
trying to work around problems in a bogus shell. Does the patch below
fix it for you?
diff --git a/t/t0300-credentials.sh b/t/t0300-credentials.sh
index 885af8f..edf6547 100755
--- a/t/t0300-credentials.sh
+++ b/t/t0300-credentials.sh
@@ -14,15 +14,15 @@ test_expect_success 'setup helper scripts' '
 	done
 	EOF
 
-	cat >git-credential-useless <<-\EOF &&
-	#!/bin/sh
+	cat >git-credential-useless <<-EOF &&
+	#!$SHELL_PATH
 	. ./dump
 	exit 0
 	EOF
 	chmod +x git-credential-useless &&
 
-	cat >git-credential-verbatim <<-\EOF &&
-	#!/bin/sh
+	echo "#!$SHELL_PATH" >git-credential-verbatim &&
+	cat >>git-credential-verbatim <<-\EOF &&
 	user=$1; shift
 	pass=$1; shift
 	. ./dump
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help