threads / patch / 7478

patchgit-quiltimport /bin/sh-ism fix

Subject: [PATCH] git-quiltimport /bin/sh-ism fix

## tl;dr

3 messages between Mar 29, 2007 and Mar 30, 2007. Diffs are folded; open one to read it.

replies: 2people: 3as markdown or json

Francis Daly· Mar 29, 2007, 21:38 UTC · lore

Bryan Wu reported /usr/local/bin/git-quiltimport: 114: Syntax error: Missing '))'

Most bourne-ish shells I have here accept
 x=$((echo x)|cat)
but all bourne-ish shells I have here accept
 x=$( (echo x)|cat)
because $(( might mean arithmetic expansion.
Signed-off-by: Francis Daly <francis@daoine.org>
---
 git-quiltimport.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to git-quiltimport.sh +1 −1
diff --git a/git-quiltimport.sh b/git-quiltimport.sh
index 08ac9bb..edccd82 100755
--- a/git-quiltimport.sh
+++ b/git-quiltimport.sh
@@ -115,7 +115,7 @@ for patch_name in $(cat "$QUILT_PATCHES/series" | grep -v '^#'); do
 	if [ -z "$dry_run" ] ; then
 		git-apply --index -C1 "$tmp_patch" &&
 		tree=$(git-write-tree) &&
-		commit=$((echo "$SUBJECT"; echo; cat "$tmp_msg") | git-commit-tree $tree -p $commit) &&
+		commit=$( (echo "$SUBJECT"; echo; cat "$tmp_msg") | git-commit-tree $tree -p $commit) &&
 		git-update-ref -m "quiltimport: $patch_name" HEAD $commit || exit 4
 	fi
 done
-- 
1.5.1.rc3-dirty
Junio C Hamano· Mar 29, 2007, 23:06 UTC · re: Francis Daly · lore

Re: [PATCH] git-quiltimport /bin/sh-ism fix

Francis Daly <francis@daoine.org> writes:
Show 8 quoted lines
> Bryan Wu reported
> /usr/local/bin/git-quiltimport: 114: Syntax error: Missing '))'
>
> Most bourne-ish shells I have here accept
>  x=$((echo x)|cat)
> but all bourne-ish shells I have here accept
>  x=$( (echo x)|cat)
> because $(( might mean arithmetic expansion.
Well spotted, thanks.
Sheesh, this is even warned in POSIX sh manpage.
Wu, Bryan· Mar 30, 2007, 02:05 UTC · re: Francis Daly · lore

Re: [PATCH] git-quiltimport /bin/sh-ism fix

On Thu, 2007-03-29 at 22:38 +0100, Francis Daly wrote:
Show 27 quoted lines
> Bryan Wu reported
> /usr/local/bin/git-quiltimport: 114: Syntax error: Missing '))'
> 
> Most bourne-ish shells I have here accept
>  x=$((echo x)|cat)
> but all bourne-ish shells I have here accept
>  x=$( (echo x)|cat)
> because $(( might mean arithmetic expansion.
> 
> Signed-off-by: Francis Daly <francis@daoine.org>
> ---
>  git-quiltimport.sh |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/git-quiltimport.sh b/git-quiltimport.sh
> index 08ac9bb..edccd82 100755
> --- a/git-quiltimport.sh
> +++ b/git-quiltimport.sh
> @@ -115,7 +115,7 @@ for patch_name in $(cat "$QUILT_PATCHES/series" | grep -v '^#'); do
>  	if [ -z "$dry_run" ] ; then
>  		git-apply --index -C1 "$tmp_patch" &&
>  		tree=$(git-write-tree) &&
> -		commit=$((echo "$SUBJECT"; echo; cat "$tmp_msg") | git-commit-tree $tree -p $commit) &&
> +		commit=$( (echo "$SUBJECT"; echo; cat "$tmp_msg") | git-commit-tree $tree -p $commit) &&
>  		git-update-ref -m "quiltimport: $patch_name" HEAD $commit || exit 4
>  	fi
>  done

Cool. Thanks a lot. -Bryan

← back to recent threads