Re: [PATCH] git-parse-remote: fix ambiguous shell bug in expand_refs_wildcard
- From
Jeff King <peff@peff.net>
- Date
- May 7, 2007, 06:36 UTC
- Message-ID
- <20070507063621.GB31445@coredump.intra.peff.net>
- In-Reply-To
- <20070505080313.GA12170@gondor.apana.org.au>
On Sat, May 05, 2007 at 06:03:13PM +1000, Herbert Xu wrote:
> In fact the rationale (C.2.2.3) in the POSIX document explicitly
> disallows the aformentioned usage as it violates the rule that an
> even number of single quotes if any can occur in an ${...} expression
> enclosed by double quotes.Yes, there's not much room for interpretation; the old git code was clearly bogus (we are working around it by using sed instead). Thanks for tracking this down, Herbert.
It looks like bash is actually broken in POSIXLY_CORRECT mode, then:
$ echo $BASH_VERSION 3.1.17(1)-release $ POSIXLY_CORRECT=1 $ foo=bar} $ echo "${foo%'}'}" bar
My interpretation of the correct behavior is that it should remove a single quote from the end of foo, and then print '} literally (that is, single quote and brace).
-Peff