bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#23222: test: incorrect operator-precedence


From: Mattias Andrée
Subject: bug#23222: test: incorrect operator-precedence
Date: Tue, 5 Apr 2016 13:57:16 +0200
User-agent: Claws Mail

Failing test-case #1:

./test -n -a -n

fails and outputs

  ./test: extra argument ‘-n’

Expected behaviour is silent success, as seen in
Bash's implementation.

Explanation: -a has higher precedence than -n.
Therefore the test is equivalent to
./test -n && ./test -n. ./test -n shall succeed
because it is not an operator, but rather a
non-empty string.


Failing test-case #2:

./test ! '' -a ''

shall fail (exit value 1), but in this
implementation it succeeds.

Explanation: ! has higher precedence than -a,
therefore the test shall be equivalent to
./test ! '' && ./test '', not ! ./test '' -a ''.

Attachment: pgpSmZkhUQ_Uv.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]