Subject: Re: bin/33956: -current /bin/sh possible regression
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, njoly@pasteur.fr>
From: Rhialto <rhialto@falu.nl>
List: netbsd-bugs
Date: 07/12/2006 00:20:02
The following reply was made to PR bin/33956; it has been noted by GNATS.

From: Rhialto <rhialto@falu.nl>
To: David Holland <dholland+netbsd@eecs.harvard.edu>
Cc: current-users@NetBSD.org, njoly@pasteur.fr, gnats-bugs@NetBSD.org
Subject: Re: bin/33956: -current /bin/sh possible regression
Date: Wed, 12 Jul 2006 02:16:18 +0200

 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.