Subject: Re: bin/33956: -current /bin/sh possible regression
To: Rhialto <firstname.lastname@example.org>
From: Chapman Flack <email@example.com>
Date: 07/11/2006 21:04:04
> In my view, the *real* problem is that the above case simply is
> undefined, hence any particular output is never a bug.
> Look at the manpage (from 3.0):
> This arguably only defines "$@", not if anything else is between the quotes.
> The author of that definition simply never contemplated that case.
Reasoning from the weaknesses of our own man page isn't dispositive,
though, because even our man page says that [a]sh is intended to
implement the POSIX semantics, which are defined:
@ Expands to the positional parameters, starting from one. When the
expansion occurs within double-quotes, and where field splitting
(see Field Splitting) is performed, each positional parameter shall
expand as a separate field, with the provision that the expansion of
the first parameter shall still be joined with the beginning part of
the original word (assuming that the expanded parameter was embedded
within a word), and the expansion of the last parameter shall still
be joined with the last part of the original word. If there are no
positional parameters, the expansion of '@' shall generate zero
fields, even when '@' is double-quoted.
Granted, even that wording would win no contests for precision, but it
does cover the case almost completely. In the particular case of NO
positional parameters, it could technically be read to allow either
"foo bar" or nothing at all as the expansion of "foo $@ bar", but that
seems more an artifact of the writing than an intent of the spec; both
existing practice and POLA would tend to rule out the 'nothing at all'