git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Use SHELL_PATH as hash bang in test suite askpass helper script.
@ 2014-09-28 22:21 Ben Walton
  2014-09-28 23:14 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Ben Walton @ 2014-09-28 22:21 UTC (permalink / raw)
  To: gitster; +Cc: git, 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.

Signed-off-by: Ben Walton <bdwalton@gmail.com>
---
 t/lib-credential.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/lib-credential.sh b/t/lib-credential.sh
index 9e7d796..ca4a6de 100755
--- a/t/lib-credential.sh
+++ b/t/lib-credential.sh
@@ -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"
-- 
1.9.1

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

* Re: [PATCH] Use SHELL_PATH as hash bang in test suite askpass helper script.
  2014-09-28 22:21 [PATCH] Use SHELL_PATH as hash bang in test suite askpass helper script Ben Walton
@ 2014-09-28 23:14 ` Jeff King
  2014-09-29  7:02   ` [PATCH] Ensure SHELL_PATH is the hash bang for " Ben Walton
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff King @ 2014-09-28 23:14 UTC (permalink / raw)
  To: Ben Walton; +Cc: gitster, git

On Sun, Sep 28, 2014 at 11:21:07PM +0100, Ben Walton wrote:

> 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.

> -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

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

* [PATCH] Ensure SHELL_PATH is the hash bang for test suite askpass helper script.
  2014-09-28 23:14 ` Jeff King
@ 2014-09-29  7:02   ` Ben Walton
  2014-09-29 17:30     ` Jeff King
  2014-09-29 17:49     ` Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: Ben Walton @ 2014-09-29  7:02 UTC (permalink / raw)
  To: gitster, peff; +Cc: git, 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.

Signed-off-by: Ben Walton <bdwalton@gmail.com>
---
 t/lib-credential.sh | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/t/lib-credential.sh b/t/lib-credential.sh
index 9e7d796..d8e41f7 100755
--- a/t/lib-credential.sh
+++ b/t/lib-credential.sh
@@ -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
-- 
1.9.1

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

* Re: [PATCH] Ensure SHELL_PATH is the hash bang for test suite askpass helper script.
  2014-09-29  7:02   ` [PATCH] Ensure SHELL_PATH is the hash bang for " Ben Walton
@ 2014-09-29 17:30     ` Jeff King
  2014-09-29 17:49     ` Junio C Hamano
  1 sibling, 0 replies; 5+ messages in thread
From: Jeff King @ 2014-09-29 17:30 UTC (permalink / raw)
  To: Ben Walton; +Cc: gitster, git

On Mon, Sep 29, 2014 at 08:02:07AM +0100, Ben Walton wrote:

> 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.
> 
> Signed-off-by: Ben Walton <bdwalton@gmail.com>

Thanks, this looks good to me.

-Peff

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

* Re: [PATCH] Ensure SHELL_PATH is the hash bang for test suite askpass helper script.
  2014-09-29  7:02   ` [PATCH] Ensure SHELL_PATH is the hash bang for " Ben Walton
  2014-09-29 17:30     ` Jeff King
@ 2014-09-29 17:49     ` Junio C Hamano
  1 sibling, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2014-09-29 17:49 UTC (permalink / raw)
  To: Ben Walton; +Cc: peff, git

Ben Walton <bdwalton@gmail.com> writes:

> 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.
>
> Signed-off-by: Ben Walton <bdwalton@gmail.com>
> ---

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.


>  t/lib-credential.sh | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/t/lib-credential.sh b/t/lib-credential.sh
> index 9e7d796..d8e41f7 100755
> --- a/t/lib-credential.sh
> +++ b/t/lib-credential.sh
> @@ -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

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

end of thread, other threads:[~2014-09-29 17:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-28 22:21 [PATCH] Use SHELL_PATH as hash bang in test suite askpass helper script Ben Walton
2014-09-28 23:14 ` Jeff King
2014-09-29  7:02   ` [PATCH] Ensure SHELL_PATH is the hash bang for " Ben Walton
2014-09-29 17:30     ` Jeff King
2014-09-29 17:49     ` Junio C Hamano

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).