From: Martijn Dekker <martijn@inlv.org>
To: zsh-workers@zsh.org
Cc: Peter Stephenson <p.stephenson@samsung.com>
Subject: [BUG] 'test' returns 1 (not >1) on error [was: test is not posix]
Date: Thu, 21 Jan 2016 14:06:38 +0100 [thread overview]
Message-ID: <56A0D7DE.5000407@inlv.org> (raw)
In-Reply-To: <20160121124113.12e2d72a@pwslap01u.europe.root.pri>
Peter Stephenson schreef op 21-01-16 om 13:41:
> Yes, we now have tests for the following cases. It's trivial to add more
> if you can think of any that might be problematic.
Something I also noticed back in May, and which I'm now reminded of, is
that test/[ returns status 1, and not 2 or higher, if an error occurs.
$ [ x = a b ]
[: too many arguments
$ echo $?
1
$ [ 1 -eq ]
zsh: parse error: condition expected: 1
$ echo $?
1
This makes it impossible to test for the failure of test/[ using the
exit status.
POSIX says the status should be 2 or higher on error:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html#tag_20_128_14
Thanks,
- Martijn
next prev parent reply other threads:[~2016-01-21 13:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-20 21:06 test is not posix Trek
2016-01-20 21:38 ` Bart Schaefer
2016-01-20 21:44 ` Trek
2016-01-20 23:46 ` Martijn Dekker
2016-01-21 12:41 ` Peter Stephenson
2016-01-21 13:06 ` Martijn Dekker [this message]
2016-01-21 16:20 ` [BUG] 'test' returns 1 (not >1) on error [was: test is not posix] Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56A0D7DE.5000407@inlv.org \
--to=martijn@inlv.org \
--cc=p.stephenson@samsung.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).