git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] t3419-*.sh: Fix arithmetic expansion syntax error
@ 2010-12-21 18:50 Ramsay Jones
  2010-12-21 20:24 ` Junio C Hamano
  2010-12-22 18:42 ` Clemens Buchacher
  0 siblings, 2 replies; 3+ messages in thread
From: Ramsay Jones @ 2010-12-21 18:50 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, drizzd


Some shells, for example dash versions older than 0.5.4, need to
spell a variable reference as '$N' rather than 'N' in an arithmetic
expansion. In order to avoid the syntax error, we change the
offending variable reference from 'i' to '$i' in function scramble.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---

Note that this test is unique in having an '#!/bin/bash' line (rather
than '#!/bin/sh'), which was (indirectly) responsible for me not
noticing this failure for a while. I don't see anything that would
require bash, so I suspect this is not intensional.

ATB,
Ramsay Jones

 t/t3419-rebase-patch-id.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t3419-rebase-patch-id.sh b/t/t3419-rebase-patch-id.sh
index 1aee483..6972b49 100755
--- a/t/t3419-rebase-patch-id.sh
+++ b/t/t3419-rebase-patch-id.sh
@@ -27,7 +27,7 @@ scramble()
 		then
 			echo "$x"
 		fi
-		i=$(((i+1) % 10))
+		i=$((($i+1) % 10))
 	done < "$1" > "$1.new"
 	mv -f "$1.new" "$1"
 }
-- 
1.7.3

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

* Re: [PATCH] t3419-*.sh: Fix arithmetic expansion syntax error
  2010-12-21 18:50 [PATCH] t3419-*.sh: Fix arithmetic expansion syntax error Ramsay Jones
@ 2010-12-21 20:24 ` Junio C Hamano
  2010-12-22 18:42 ` Clemens Buchacher
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2010-12-21 20:24 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: GIT Mailing-list, drizzd

Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:

> Note that this test is unique in having an '#!/bin/bash' line (rather
> than '#!/bin/sh'),...

Thanks for spotting, and that is idiotic for us to have such a script.
We should fix the shebang line as well.

A quick git-grep shows that this is the only instance of this problem
(outside contrib/completion/git-completion.bash, that is).

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

* Re: [PATCH] t3419-*.sh: Fix arithmetic expansion syntax error
  2010-12-21 18:50 [PATCH] t3419-*.sh: Fix arithmetic expansion syntax error Ramsay Jones
  2010-12-21 20:24 ` Junio C Hamano
@ 2010-12-22 18:42 ` Clemens Buchacher
  1 sibling, 0 replies; 3+ messages in thread
From: Clemens Buchacher @ 2010-12-22 18:42 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Junio C Hamano, GIT Mailing-list

On Tue, Dec 21, 2010 at 06:50:47PM +0000, Ramsay Jones wrote:
> 
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>

Thanks.

> Note that this test is unique in having an '#!/bin/bash' line (rather
> than '#!/bin/sh'), which was (indirectly) responsible for me not
> noticing this failure for a while. I don't see anything that would
> require bash, so I suspect this is not intensional.

Indeed. I actually removed all bashisms from the script, but then
apparently forgot to get rid of #!/bin/bash as well.

Clemens

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

end of thread, other threads:[~2010-12-22 18:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-21 18:50 [PATCH] t3419-*.sh: Fix arithmetic expansion syntax error Ramsay Jones
2010-12-21 20:24 ` Junio C Hamano
2010-12-22 18:42 ` Clemens Buchacher

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