Subject: Re: bin/33956: -current /bin/sh possible regression
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org, njoly@pasteur.fr>
From: Chapman Flack <nblists@anastigmatix.net>
List: netbsd-bugs
Date: 07/12/2006 01:05:05
The following reply was made to PR bin/33956; it has been noted by GNATS.

From: Chapman Flack <nblists@anastigmatix.net>
To: Rhialto <rhialto@falu.nl>
Cc: David Holland <dholland+netbsd@eecs.harvard.edu>,
	current-users@NetBSD.org, njoly@pasteur.fr, gnats-bugs@NetBSD.org
Subject: Re: bin/33956: -current /bin/sh possible regression
Date: Tue, 11 Jul 2006 21:04:04 -0400

 Rhialto wrote:
 > 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'
 interpretation.
 
 -Chap