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:10:07
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:09:39 +0200
On Mon 10 Jul 2006 at 18:05:32 -0400, David Holland wrote:
> sh -c 'foo() { printargv "Testing ${@} fnord"; }; foo a b'
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):
@ 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.
-Olaf.
--
___ Olaf 'Rhialto' Seibert -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl -- Cetero censeo "authored" delendum esse.