* git stash syntax error under AIX 5.3
@ 2010-11-03 14:05 Brian Riehman
2010-11-03 15:07 ` Jonathan Nieder
0 siblings, 1 reply; 3+ messages in thread
From: Brian Riehman @ 2010-11-03 14:05 UTC (permalink / raw)
To: git
The stash command relies on bash-specific shell scripting techniques
when the shebang line lists Bourne shell. This was introduced in
b0f0ecd97924ee775e7f3b29366133448f4f8e15. The error was noticed when
running under AIX 5.3:
$ /bin/sh -n git-stash.sh
git-stash.sh[63]: syntax error at line 498 : `"' unmatched
$ /bin/sh -n git-stash-modified.sh
$ diff git-stash.sh git-stash-modified.sh
314,321c314,321
< if test "${REV}" != "${REV%{*\}}"
< then
< # maintainers: it would be better if git rev-parse indicated
< # this condition with a non-zero status code but as of
1.7.2.1 it
< # it did not. So, we use non-empty stderr output as a
proxy for the
< # condition of interest.
< test -z "$(git rev-parse "$REV" 2>&1 >/dev/null)" ||
die "$REV does not exist in the stash log"
< fi
---
> # if test "${REV}" != "${REV%{*\}}"
> # then
> # # maintainers: it would be better if git rev-parse indicated
> # # this condition with a non-zero status code but as of 1.7.2.1 it
> # # it did not. So, we use non-empty stderr output as a proxy for the
> # # condition of interest.
> # test -z "$(git rev-parse "$REV" 2>&1 >/dev/null)" || die "$REV does not exist in the stash log"
> # fi
$ head -1 git-stash.sh
#!/bin/sh
Removing the code from that commit causes the stash command to work
properly. I am not sure if other systems have /bin/sh symbolically
linked to /bin/bash, but in AIX the /bin/sh fails to properly parse
the default git-stash.sh.
I am not sure how to correct this logic since Bourne shell does not
have an equally powerful search and replace variable substitution
operator nor do I know exactly what this is meant to filter out of the
variable. For now, I have simply patched the source to comment out
those lines.
Brian Riehman
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: git stash syntax error under AIX 5.3
2010-11-03 14:05 git stash syntax error under AIX 5.3 Brian Riehman
@ 2010-11-03 15:07 ` Jonathan Nieder
2010-11-03 15:29 ` Brian Riehman
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Nieder @ 2010-11-03 15:07 UTC (permalink / raw)
To: Brian Riehman; +Cc: git
Hi Brian,
Brian Riehman wrote:
> The stash command relies on bash-specific shell scripting techniques
Git actually uses the ${var%glob} syntax pretty widely, and it is
fairly portable (see http://unix.org/2008edition/ and search for "sh -"
for details). I suspect the problem is rather the seemingly-unbalanced
braces:
> < if test "${REV}" != "${REV%{*\}}"
How about this patch?
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
diff --git a/git-stash.sh b/git-stash.sh
index 5fb1245..0a41226 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -311,7 +311,7 @@ parse_flags_and_rev()
test "$ref_stash" = "$(git rev-parse --symbolic-full-name "${REV%@*}")" &&
IS_STASH_REF=t
- if test "${REV}" != "${REV%{*\}}"
+ if test "${REV}" != "${REV%\{*\}}"
then
# maintainers: it would be better if git rev-parse indicated
# this condition with a non-zero status code but as of 1.7.2.1 it
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: git stash syntax error under AIX 5.3
2010-11-03 15:07 ` Jonathan Nieder
@ 2010-11-03 15:29 ` Brian Riehman
0 siblings, 0 replies; 3+ messages in thread
From: Brian Riehman @ 2010-11-03 15:29 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: git
Thanks, Jonathan. That did indeed fix it. Thanks for your help and
clarification that it does indeed work in my shell when escaped
properly.
On Wed, Nov 3, 2010 at 10:07 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Hi Brian,
>
> Brian Riehman wrote:
>
>> The stash command relies on bash-specific shell scripting techniques
>
> Git actually uses the ${var%glob} syntax pretty widely, and it is
> fairly portable (see http://unix.org/2008edition/ and search for "sh -"
> for details). I suspect the problem is rather the seemingly-unbalanced
> braces:
>
>> < if test "${REV}" != "${REV%{*\}}"
>
> How about this patch?
>
> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
> ---
> diff --git a/git-stash.sh b/git-stash.sh
> index 5fb1245..0a41226 100755
> --- a/git-stash.sh
> +++ b/git-stash.sh
> @@ -311,7 +311,7 @@ parse_flags_and_rev()
> test "$ref_stash" = "$(git rev-parse --symbolic-full-name "${REV%@*}")" &&
> IS_STASH_REF=t
>
> - if test "${REV}" != "${REV%{*\}}"
> + if test "${REV}" != "${REV%\{*\}}"
> then
> # maintainers: it would be better if git rev-parse indicated
> # this condition with a non-zero status code but as of 1.7.2.1 it
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-11-03 15:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-03 14:05 git stash syntax error under AIX 5.3 Brian Riehman
2010-11-03 15:07 ` Jonathan Nieder
2010-11-03 15:29 ` Brian Riehman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox