Discussion:
[Qemu-devel] [Bug 1525682] Re: configure: fix POSIX compatibility issue
Eric Blake
2015-12-14 19:08:47 UTC
Permalink
[adding autoconf, which likes to document shell bugs]
OK, so I misidentified the issue and screwed up my bug report.
$ a=1
$ b=2
$ echo "${a+($b)}"
ksh: ${a+($b)}": bad substitution
That's a bug in pdksh; see the POSIX interpretation:

http://austingroupbugs.net/view.php?id=221#c399

For parameter expansions other than the four varieties that provide
for substring processing, within the string of characters from an
enclosed "${" to the matching '}', the double-quotes within which
the expansion occurs shall preserve the literal value of all
characters, with the exception of the characters double-quote,
backquote, <dollar-sign>, and <backslash>.

The fact that you are using "" outside the ${} means that all characters
between + and } should be used literally (the same as if you had done
'echo "($b)"'). According to POSIX, it should not be a syntax error, so
you should report this to the pdksh shell developers.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
Loading...