zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: koichi nakashima <koichi@nksm.name>, zsh-workers@zsh.org
Subject: Re: [BUG] test ! "-o" ([ ! -o ]) exit status should be 1
Date: Tue, 10 Aug 2021 09:21:13 +0100 (BST)	[thread overview]
Message-ID: <39438820.794518.1628583673075@mail2.virginmedia.com> (raw)
In-Reply-To: <835587636.777488.1628518618581@mail2.virginmedia.com>

> On 09 August 2021 at 15:16 Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> > On 09 August 2021 at 11:55 koichi nakashima <koichi@nksm.name> wrote:
> > 
> > 
> > In the following code, I expected the exit status to be 1.
> > However, in zsh 5.0.3 and later, it was actually 0.
> > 
> > $ zsh -c '[ ! -o ]; echo "$ZSH_VERSION: $?"'
> > 4.3.17: 1
> 
> It's a little bizarre that we've actually got a test for this, and it's
> deliberately set up this way.  But I think the fix for this case is simple
> — more complicated expressions with "test" or "[", as opposed to "[[", can
> go horribly wrong, but two arguments should be OK — so I've just flipped
> the test.  It can't possibly be right that -a and -o are treated differently
> in this context, can it?

I've assumed this is uncontroversial, which I think it is, and submitted this.
I'm guessing the test just got set up to reflect the status quo rather than
some deeper (but bizarre) thinking.

pws


      reply	other threads:[~2021-08-10  8:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09 10:55 koichi nakashima
2021-08-09 14:16 ` Peter Stephenson
2021-08-10  8:21   ` Peter Stephenson [this message]

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=39438820.794518.1628583673075@mail2.virginmedia.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=koichi@nksm.name \
    --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).