Comment 12 for bug 1525682

Revision history for this message
Eric Blake (eblake) wrote : Re: [Qemu-devel] [Bug 1525682] Re: configure: fix POSIX compatibility issue

[adding autoconf, which likes to document shell bugs]

On 12/14/2015 04:34 AM, Dmitrij D. Czarkoff wrote:
> OK, so I misidentified the issue and screwed up my bug report.
>
> The shell is pdksh on OpenBSD, and the real issue is with parentheses:
>
> $ 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