Subject: Re: bin/33956: -current /bin/sh possible regression
To: David Holland <dholland+netbsd@eecs.harvard.edu>
From: Rhialto <rhialto@falu.nl>
List: current-users
Date: 07/12/2006 02:16:18
On Wed 12 Jul 2006 at 02:09:39 +0200, Rhialto wrote:
>      @            Expands to the positional parameters, starting from one.
>                   When the expansion occurs within double-quotes, each posi-
>                   tional parameter expands as a separate argument.  If there
>                   are no positional parameters, the expansion of @ generates
>                   zero arguments, even when @ is double-quoted.  What this
>                   basically means, for example, is if $1 is ``abc'' and $2 is
>                   ``def ghi'', then "$@" expands to the two arguments:
> 
>                         "abc" "def ghi"
> 
> This arguably only defines "$@", not if anything else is between the quotes.
> The author of that definition simply never contemplated that case.

Even if one argued that "Testing ${@} fnord" is a meaningful
substitution, then according to the above definition, it should produce
zero arguments if there are no positional parameters. Yet,

    sh -c 'foo() { echo "Testing ${@} fnord"; }; foo'

produces (on 3.0)

    Testing  fnord

which I must consider a bug.

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert      -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl        -- Cetero censeo "authored" delendum esse.