git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] t6030: use $SHELL_PATH to invoke user's preferred shell instead of bare sh
@ 2011-08-29 20:09 Brandon Casey
  2011-08-30 20:15 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Brandon Casey @ 2011-08-29 20:09 UTC (permalink / raw)
  To: gitster; +Cc: git, Brandon Casey

From: Brandon Casey <drafnel@gmail.com>

Some platforms (IRIX, Solaris) provide an ancient /bin/sh which chokes on
modern shell syntax like $().  SHELL_PATH is provided to allow the user to
specify a working sh, let's use it here.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
 t/t6030-bisect-porcelain.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 62125ec..c53af62 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -732,7 +732,7 @@ test_expect_success 'bisect: demonstrate identification of damage boundary' "
 	git bisect reset &&
 	git checkout broken &&
 	git bisect start broken master --no-checkout &&
-	git bisect run sh -c '
+	git bisect run \"$SHELL_PATH\" -c '
 		GOOD=\$(git for-each-ref \"--format=%(objectname)\" refs/bisect/good-*) &&
 		git rev-list --objects BISECT_HEAD --not \$GOOD >tmp.\$\$ &&
 		git pack-objects --stdout >/dev/null < tmp.\$\$
-- 
1.7.6.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] t6030: use $SHELL_PATH to invoke user's preferred shell instead of bare sh
  2011-08-29 20:09 [PATCH] t6030: use $SHELL_PATH to invoke user's preferred shell instead of bare sh Brandon Casey
@ 2011-08-30 20:15 ` Junio C Hamano
  2011-08-30 20:27   ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2011-08-30 20:15 UTC (permalink / raw)
  To: Brandon Casey; +Cc: git, Brandon Casey

Brandon Casey <casey@nrlssc.navy.mil> writes:

> From: Brandon Casey <drafnel@gmail.com>
>
> Some platforms (IRIX, Solaris) provide an ancient /bin/sh which chokes on
> modern shell syntax like $().  SHELL_PATH is provided to allow the user to
> specify a working sh, let's use it here.
>
> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
> ---
>  t/t6030-bisect-porcelain.sh |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
> index 62125ec..c53af62 100755
> --- a/t/t6030-bisect-porcelain.sh
> +++ b/t/t6030-bisect-porcelain.sh
> @@ -732,7 +732,7 @@ test_expect_success 'bisect: demonstrate identification of damage boundary' "
>  	git bisect reset &&
>  	git checkout broken &&
>  	git bisect start broken master --no-checkout &&
> -	git bisect run sh -c '
> +	git bisect run \"$SHELL_PATH\" -c '
>  		GOOD=\$(git for-each-ref \"--format=%(objectname)\" refs/bisect/good-*) &&
>  		git rev-list --objects BISECT_HEAD --not \$GOOD >tmp.\$\$ &&
>  		git pack-objects --stdout >/dev/null < tmp.\$\$

Hmm, shouldn't we also be quoting '$' in front of SHELL_PATH to make the
test_expect_success interpolate the value of SHELL_PATH, instead of hoping
that SHELL_PATH does not have double-quote in it when the shell that forms
parameters given to test_expect_success interpolates it?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] t6030: use $SHELL_PATH to invoke user's preferred shell instead of bare sh
  2011-08-30 20:15 ` Junio C Hamano
@ 2011-08-30 20:27   ` Junio C Hamano
  2011-08-30 20:55     ` Brandon Casey
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2011-08-30 20:27 UTC (permalink / raw)
  To: Brandon Casey, Brandon Casey; +Cc: git

Junio C Hamano <gitster@pobox.com> writes:

>> +	git bisect run \"$SHELL_PATH\" -c '
>>  		GOOD=\$(git for-each-ref \"--format=%(objectname)\" refs/bisect/good-*) &&
>>  		git rev-list --objects BISECT_HEAD --not \$GOOD >tmp.\$\$ &&
>>  		git pack-objects --stdout >/dev/null < tmp.\$\$
>
> Hmm, shouldn't we also be quoting '$' in front of SHELL_PATH to make the
> test_expect_success interpolate the value of SHELL_PATH, instead of hoping
> that SHELL_PATH does not have double-quote in it when the shell that forms
> parameters given to test_expect_success interpolates it?

By doing this silly thing:

	$ mkdir '/var/tmp/a"b c/'
        $ ln -s /bin/sh '/var/tmp/a"b c/shell'

and then adding

	SHELL_PATH='/var/tmp/a"b c/shell'

after we source "test-lib.sh" in t6030, I see this breaks when the shell
parses to figure out what parameters to call test_expect_success with.

 t/t6030-bisect-porcelain.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 68c0e97..cd9de63 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -701,7 +701,7 @@ test_expect_success 'bisect: demonstrate identification of damage boundary' "
 	git bisect reset &&
 	git checkout broken &&
 	git bisect start broken master --no-checkout &&
-	git bisect run \"$SHELL_PATH\" -c '
+	git bisect run \"\$SHELL_PATH\" -c '
 		GOOD=\$(git for-each-ref \"--format=%(objectname)\" refs/bisect/good-*) &&
 		git rev-list --objects BISECT_HEAD --not \$GOOD >tmp.\$\$ &&
 		git pack-objects --stdout >/dev/null < tmp.\$\$

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] t6030: use $SHELL_PATH to invoke user's preferred shell instead of bare sh
  2011-08-30 20:27   ` Junio C Hamano
@ 2011-08-30 20:55     ` Brandon Casey
  0 siblings, 0 replies; 4+ messages in thread
From: Brandon Casey @ 2011-08-30 20:55 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Brandon Casey, git

On 08/30/2011 03:27 PM, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
> 
>>> +	git bisect run \"$SHELL_PATH\" -c '
>>>  		GOOD=\$(git for-each-ref \"--format=%(objectname)\" refs/bisect/good-*) &&
>>>  		git rev-list --objects BISECT_HEAD --not \$GOOD >tmp.\$\$ &&
>>>  		git pack-objects --stdout >/dev/null < tmp.\$\$
>>
>> Hmm, shouldn't we also be quoting '$' in front of SHELL_PATH to make the
>> test_expect_success interpolate the value of SHELL_PATH, instead of hoping
>> that SHELL_PATH does not have double-quote in it when the shell that forms
>> parameters given to test_expect_success interpolates it?

Yep, makes sense.  Good catch.  Thanks.

-Brandon


> By doing this silly thing:
> 
> 	$ mkdir '/var/tmp/a"b c/'
>         $ ln -s /bin/sh '/var/tmp/a"b c/shell'
> 
> and then adding
> 
> 	SHELL_PATH='/var/tmp/a"b c/shell'
> 
> after we source "test-lib.sh" in t6030, I see this breaks when the shell
> parses to figure out what parameters to call test_expect_success with.
> 
>  t/t6030-bisect-porcelain.sh |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
> index 68c0e97..cd9de63 100755
> --- a/t/t6030-bisect-porcelain.sh
> +++ b/t/t6030-bisect-porcelain.sh
> @@ -701,7 +701,7 @@ test_expect_success 'bisect: demonstrate identification of damage boundary' "
>  	git bisect reset &&
>  	git checkout broken &&
>  	git bisect start broken master --no-checkout &&
> -	git bisect run \"$SHELL_PATH\" -c '
> +	git bisect run \"\$SHELL_PATH\" -c '
>  		GOOD=\$(git for-each-ref \"--format=%(objectname)\" refs/bisect/good-*) &&
>  		git rev-list --objects BISECT_HEAD --not \$GOOD >tmp.\$\$ &&
>  		git pack-objects --stdout >/dev/null < tmp.\$\$

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-08-30 20:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-29 20:09 [PATCH] t6030: use $SHELL_PATH to invoke user's preferred shell instead of bare sh Brandon Casey
2011-08-30 20:15 ` Junio C Hamano
2011-08-30 20:27   ` Junio C Hamano
2011-08-30 20:55     ` Brandon Casey

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 NNTP newsgroup(s).