git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] t0003: properly quote $HOME
@ 2010-10-17 19:13 Thomas Rast
  2010-10-17 19:18 ` Jonathan Nieder
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Thomas Rast @ 2010-10-17 19:13 UTC (permalink / raw)
  To: Junio C Hamano, Petr Onderka; +Cc: git

6df42ab (Add global and system-wide gitattributes, 2010-09-01) forgot
to quote one instance of $HOME in the tests.  This broke the test for
me with the shell complaining about an ambiguous redirect (but only
when run with --root for some reason).

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
 t/t0003-attributes.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh
index 25205ac..e75153b 100755
--- a/t/t0003-attributes.sh
+++ b/t/t0003-attributes.sh
@@ -38,7 +38,7 @@ test_expect_success 'setup' '
 	) >a/b/.gitattributes
 	(
 		echo "global test=global"
-	) >$HOME/global-gitattributes
+	) >"$HOME"/global-gitattributes
 
 '
 
-- 
1.7.3.1.266.g3c065

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

* Re: [PATCH] t0003: properly quote $HOME
  2010-10-17 19:13 [PATCH] t0003: properly quote $HOME Thomas Rast
@ 2010-10-17 19:18 ` Jonathan Nieder
  2010-10-17 19:34   ` Thomas Rast
  2010-10-17 19:37 ` [PATCH] " Matthieu Moy
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Jonathan Nieder @ 2010-10-17 19:18 UTC (permalink / raw)
  To: Thomas Rast; +Cc: Junio C Hamano, Petr Onderka, git

Thomas Rast wrote:

> 6df42ab (Add global and system-wide gitattributes, 2010-09-01) forgot
> to quote one instance of $HOME in the tests.  This broke the test for
> me with the shell complaining about an ambiguous redirect (but only
> when run with --root for some reason).

Thanks.  What shell do you use?

IIRC it is not ambiguous according to POSIX but since e.g. OpenBSD
complains it is worth fixing.

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

* Re: [PATCH] t0003: properly quote $HOME
  2010-10-17 19:18 ` Jonathan Nieder
@ 2010-10-17 19:34   ` Thomas Rast
  2010-10-18  9:09     ` [PATCH v2] " Thomas Rast
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Rast @ 2010-10-17 19:34 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Junio C Hamano, Petr Onderka, git

Jonathan Nieder wrote:
> Thomas Rast wrote:
> 
> > 6df42ab (Add global and system-wide gitattributes, 2010-09-01) forgot
> > to quote one instance of $HOME in the tests.  This broke the test for
> > me with the shell complaining about an ambiguous redirect (but only
> > when run with --root for some reason).
> 
> Thanks.  What shell do you use?
> 
> IIRC it is not ambiguous according to POSIX but since e.g. OpenBSD
> complains it is worth fixing.

Oh, huh, so much for the theory that it's --root causing it:

  $ sh ./t0003-attributes.sh -q
  # passed all 8 test(s)
  1..8
  $ dash ./t0003-attributes.sh -q
  # passed all 8 test(s)
  1..8
  $ bash ./t0003-attributes.sh -q
  not ok - 1 setup
[...]
  $ bash --version
  GNU bash, version 4.1.7(1)-release (x86_64-suse-linux-gnu)
[...]

Then again, so much for your theory that it's only OpenBSD... ;-)

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

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

* Re: [PATCH] t0003: properly quote $HOME
  2010-10-17 19:13 [PATCH] t0003: properly quote $HOME Thomas Rast
  2010-10-17 19:18 ` Jonathan Nieder
@ 2010-10-17 19:37 ` Matthieu Moy
  2010-10-17 21:03 ` Johannes Sixt
  2010-10-18 19:15 ` Junio C Hamano
  3 siblings, 0 replies; 8+ messages in thread
From: Matthieu Moy @ 2010-10-17 19:37 UTC (permalink / raw)
  To: Thomas Rast; +Cc: Junio C Hamano, Petr Onderka, git

Thomas Rast <trast@student.ethz.ch> writes:

> 6df42ab (Add global and system-wide gitattributes, 2010-09-01) forgot
> to quote one instance of $HOME in the tests.  This broke the test for
> me with the shell complaining about an ambiguous redirect (but only
> when run with --root for some reason).

My bad, sorry. ACK for the fix.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

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

* Re: [PATCH] t0003: properly quote $HOME
  2010-10-17 19:13 [PATCH] t0003: properly quote $HOME Thomas Rast
  2010-10-17 19:18 ` Jonathan Nieder
  2010-10-17 19:37 ` [PATCH] " Matthieu Moy
@ 2010-10-17 21:03 ` Johannes Sixt
  2010-10-18 19:15 ` Junio C Hamano
  3 siblings, 0 replies; 8+ messages in thread
From: Johannes Sixt @ 2010-10-17 21:03 UTC (permalink / raw)
  To: Thomas Rast; +Cc: Junio C Hamano, Petr Onderka, git

On Sonntag, 17. Oktober 2010, Thomas Rast wrote:
> 6df42ab (Add global and system-wide gitattributes, 2010-09-01) forgot
> to quote one instance of $HOME in the tests.  This broke the test for
> me with the shell complaining about an ambiguous redirect (but only
> when run with --root for some reason).
>
> Signed-off-by: Thomas Rast <trast@student.ethz.ch>
> ---
>  t/t0003-attributes.sh |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh
> index 25205ac..e75153b 100755
> --- a/t/t0003-attributes.sh
> +++ b/t/t0003-attributes.sh
> @@ -38,7 +38,7 @@ test_expect_success 'setup' '
>  	) >a/b/.gitattributes
>  	(
>  		echo "global test=global"
> -	) >$HOME/global-gitattributes
> +	) >"$HOME"/global-gitattributes
>
>  '

FWIW, the failure is due to bash trying to be helpful. Variable expansions 
after redirections are not word-split, but bash incorrectly detects 
an "ambiguous redirect" if the expanded text contains IFS characters. Your 
fix is of course the right way to work it around. But you might update the 
commit message.

-- Hannes

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

* [PATCH v2] t0003: properly quote $HOME
  2010-10-17 19:34   ` Thomas Rast
@ 2010-10-18  9:09     ` Thomas Rast
  2010-10-18 10:02       ` Jonathan Nieder
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Rast @ 2010-10-18  9:09 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Matthieu Moy, Johannes Sixt, Jonathan Nieder, git, Petr Onderka

6df42ab (Add global and system-wide gitattributes, 2010-09-01) forgot
to quote one instance of $HOME in the tests.  This would be valid
according to POSIX, but bash 4 helpfully declines to execute the
command in question with an "ambiguous redirection" error.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---

Changed the commit message to state the actual reason.

 t/t0003-attributes.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh
index 25205ac..e75153b 100755
--- a/t/t0003-attributes.sh
+++ b/t/t0003-attributes.sh
@@ -38,7 +38,7 @@ test_expect_success 'setup' '
 	) >a/b/.gitattributes
 	(
 		echo "global test=global"
-	) >$HOME/global-gitattributes
+	) >"$HOME"/global-gitattributes
 
 '
 
-- 
1.7.3.1.270.gbc760

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

* Re: [PATCH v2] t0003: properly quote $HOME
  2010-10-18  9:09     ` [PATCH v2] " Thomas Rast
@ 2010-10-18 10:02       ` Jonathan Nieder
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Nieder @ 2010-10-18 10:02 UTC (permalink / raw)
  To: Thomas Rast
  Cc: Junio C Hamano, Matthieu Moy, Johannes Sixt, git, Petr Onderka

Thomas Rast wrote:

>                                               This would be valid
> according to POSIX, but bash 4 helpfully declines to execute the
> command in question with an "ambiguous redirection" error.

For the benefit of those wondering why they never saw this problem,
even after using bash for a while: bash in POSIX mode (e.g. when
running as "sh") does not have the same problem.

Presumably that's why this problem was not noticed until on a platform
without bash as /bin/sh, in v1.7.0-rc1~30 (work around an obnoxious
bash "safety feature" on OpenBSD, 2010-01-26).

I still like the patch. :)

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

* Re: [PATCH] t0003: properly quote $HOME
  2010-10-17 19:13 [PATCH] t0003: properly quote $HOME Thomas Rast
                   ` (2 preceding siblings ...)
  2010-10-17 21:03 ` Johannes Sixt
@ 2010-10-18 19:15 ` Junio C Hamano
  3 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2010-10-18 19:15 UTC (permalink / raw)
  To: Thomas Rast; +Cc: Junio C Hamano, Petr Onderka, git

Thomas Rast <trast@student.ethz.ch> writes:

> 6df42ab (Add global and system-wide gitattributes, 2010-09-01) forgot
> to quote one instance of $HOME in the tests.  This broke the test for
> me with the shell complaining about an ambiguous redirect (but only
> when run with --root for some reason).

Sounds like a similar breakage to what was fixed in 3fa7c3d (work around
an obnoxious bash "safety feature" on OpenBSD, 2010-01-26) to me.

Thanks.

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

end of thread, other threads:[~2010-10-18 19:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-17 19:13 [PATCH] t0003: properly quote $HOME Thomas Rast
2010-10-17 19:18 ` Jonathan Nieder
2010-10-17 19:34   ` Thomas Rast
2010-10-18  9:09     ` [PATCH v2] " Thomas Rast
2010-10-18 10:02       ` Jonathan Nieder
2010-10-17 19:37 ` [PATCH] " Matthieu Moy
2010-10-17 21:03 ` Johannes Sixt
2010-10-18 19:15 ` 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).