X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Message-ID: <ddc185be0808120836v7f00219br31952f20089f052@mail.gmail.com>
Date: Tue, 12 Aug 2008 19:36:13 +0400
From: "Dmitry Semyonov" <linulin@gmail.com>
To: cygwin@cygwin.com
Subject: ash-20040127-3: Invalid behavior of negated pipeline
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Hello all,

 -- begin --
$ bash -c '! true | false; echo $?'
0

$ ash -c '! true | false; echo $?'
1
 -- end --

Mostly "if" conditions are affected by this issue.

Quote[1] from the "Shell Command Language" standard: "If the reserved
word ! does not precede the pipeline, the exit status shall be the
exit status of the last command specified in the pipeline. Otherwise,
the exit status shall be the logical NOT of the exit status of the
last command. That is, if the last command returns zero, the exit
status shall be 1; if the last command returns greater than zero, the
exit status shall be zero."

[1] http://www.opengroup.org/onlinepubs/009695399/utilities/xcu_chap02.html#tag_02_09_02


So, in this particular case, ash is not compliant with the standard,
nor it is compatible with bash or dash (Debian ash derivative).


P.S.
$ cygcheck -c ash bash
Cygwin Package Information
Package              Version        Status
ash                  20040127-3     OK
bash                 3.2.39-20      OK

P.P.S.
Please, CC me. I'm not on the list.

-- 
...Bye..Dmitry.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

