Subject: bin/34646: /bin/test does not conform to POSIX
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <rillig@NetBSD.org>
List: netbsd-bugs
Date: 09/28/2006 07:40:00
>Number:         34646
>Category:       bin
>Synopsis:       /bin/test does not conform to POSIX
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep 28 07:40:00 +0000 2006
>Originator:     Roland Illig
>Release:        NetBSD 3.0_STABLE
>Organization:
	
>Environment:
	
	
System: NetBSD bacc.roland-illig.de 3.0_STABLE NetBSD 3.0_STABLE (GENERIC) #0: Sat Jun 17 13:16:17 CEST 2006 build@baccf5ee.roland-illig.de:/home/build/3/2006-06/i386/work/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:

http://www.opengroup.org/onlinepubs/000095399/utilities/test.html

says:

...
3 arguments:
* If $2 is a binary primary, perform the binary test of $1 and $3.
* If $1 is '!', negate the two-argument test of $2 and $3.
* [XSI] [Option Start] If $1 is '(' and $3 is ')', perform the unary
  test of $2. [Option End]
* Otherwise, produce unspecified results.
                                                                        
But NetBSD's /bin/test checks for the second condition before checking
the first.

>How-To-Repeat:

/bin/test ! = foo

>Fix:

>Unformatted: