Subject: bin/8893: possible parsing bug in test?
To: None <gnats-bugs@gnats.netbsd.org>
From: None <abs@mono.org>
List: netbsd-bugs
Date: 11/27/1999 03:48:56
>Number:         8893
>Category:       bin
>Synopsis:       possible parsing bug in test
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 27 03:48:00 1999
>Last-Modified:
>Originator:     David Brownlee
>Organization:

		David/absolute
>Release:        NetBSD 1.4.1
>Environment:
	
System: NetBSD oblivion.mono.org 1.4.1 NetBSD 1.4.1 (_OBLIVION_) #2: Sat Oct 23 10:51:48 BST 1999 abs@oblivion:/usr/src/sys/arch/i386/compile/_OBLIVION_ i386


>Description:
	The following breaks with '[: HELP: unknown operand' if $x is '-s'.
	[ "$x" = HELP -o "$x" = BOB ] && echo bob
	While the following works fine
	[ "$x" = HELP ] && echo bob

	I'm assuming that test is interpreting the -s as a test flag.

>How-To-Repeat:
	See above

>Fix:
	If the above breakage is correct, then just about every shell script
	that uses -o or -a with arbitrary string comparison is going to need
	to do something like:
	[ "X$x" = XHELP -o "X$x" = XBOB ] && echo bob
	which is ugly, but if true needs to be documented in the manpage

	For reference, Solaris 2.6 does not have this problem.

>Audit-Trail:
>Unformatted: