From owner-freebsd-hackers Mon Mar 6 1: 1:49 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from dt051n0b.san.rr.com (dt051n0b.san.rr.com [204.210.32.11]) by hub.freebsd.org (Postfix) with ESMTP id 2915737BCE1 for ; Mon, 6 Mar 2000 01:01:45 -0800 (PST) (envelope-from Doug@gorean.org) Received: from gorean.org (doug@master [10.0.0.2]) by dt051n0b.san.rr.com (8.9.3/8.9.3) with ESMTP id AAA10711; Mon, 6 Mar 2000 00:59:39 -0800 (PST) (envelope-from Doug@gorean.org) Message-ID: <38C3737B.63ACC551@gorean.org> Date: Mon, 06 Mar 2000 00:59:39 -0800 From: Doug Barton Organization: Triborough Bridge & Tunnel Authority X-Mailer: Mozilla 4.72 [en] (X11; U; FreeBSD 4.0-CURRENT-0302 i386) X-Accept-Language: en MIME-Version: 1.0 To: Sheldon Hearn Cc: Max Khon , hackers@FreeBSD.ORG Subject: Re: empty lists in for References: <33397.952332067@axl.ops.uunet.co.za> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Sheldon Hearn wrote: > > On Sat, 04 Mar 2000 15:36:43 +0200, Sheldon Hearn wrote: > > > I seem to remember POSIX being ambiguous on this one, but my books > > are at the office. If you haven't gotten a more conclusive answer by > > Monday, mail me and I'll look it up. > > I was wrong about POSIX being ambiguous in this regard; it's SUSV2 which > is ambiguous. From POSIX.2 3.9.4.2: > > First, the list of words following _in_ shall be expanded to > generate a list of items. Then, the variable shall be > set to each item, in turn, and the executed each > time. If no items result from the expansion, the > shall not be executed. [...] > > Exit Status: The exit status of a _for_ command shall be the > exit status of the last command that executes. If there are no > items, the exit status shall be zero. > > > Neither bash nor ksh claim to be particularly POSIX compliant. our > > /bin/sh does. > > This is the part of my original post that Doug barton objected to. > Perhaps bash has POSIX compliance as one of its goals, which invalidates > my original statement. On this score, however, both bash and ksh are > not compliant. I think that Martin's post contained the informative bit: I just checked POSIX 1003.2. for name [ in word ] do compound-list done the "in word" is optional. Therefore: for name in ; do echo $name; done is an error, whereas for name ; do echo $name; done is not, and Bash does not report it as so, in or out of POSIX mode. Also, your snippet clearly expects that there will be a word after "in." It could easily be argued from that context that the presence of "in" without a "word" to go with it is an error, even without the bit from Martin's post. All that said, if the ports make system depends on the current behavior, it has to be fixed before we can contemplate any changes. Doug -- "Welcome to the desert of the real." - Laurence Fishburne as Morpheus, "The Matrix" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message