Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] test ! "-o" ([ ! -o ]) exit status should be 1



> On 09 August 2021 at 15:16 Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> > On 09 August 2021 at 11:55 koichi nakashima <koichi@xxxxxxxxx> 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




Messages sorted by: Reverse Date, Date, Thread, Author