From nobody  Sat Mar 21 11:55:35 1998
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.8/8.8.8) id LAA15097;
          Sat, 21 Mar 1998 11:55:35 -0800 (PST)
          (envelope-from nobody)
Message-Id: <199803211955.LAA15097@hub.freebsd.org>
Date: Sat, 21 Mar 1998 11:55:35 -0800 (PST)
From: giffunip@asme.org
To: freebsd-gnats-submit@freebsd.org
Subject: sh doesn't work properly on certain configuration scripts
X-Send-Pr-Version: www-1.0

>Number:         6087
>Category:       bin
>Synopsis:       sh doesn't work properly on certain configuration scripts
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 21 12:00:01 PST 1998
>Closed-Date:    Wed Sep 16 23:58:03 MEST 1998
>Last-Modified:  Wed Sep 16 23:59:21 MEST 1998
>Originator:     Pedro F. Giffuni
>Release:        2.2.5-R
>Organization:
U. Nacional de Colombia
>Environment:
FreeBSD giffuni.usc.unal.edu.co 2.2.5-RELEASE FreeBSD 2.2.5-RELEASE #0: Wed Mar 18 23:19:52 COT 1998     pedro@giffuni.usc.unal.edu.co:/usr/src/sys/compile/COMPAQ  i386  
>Description:
While using a configure script a problem with FreeBSD's sh was revealed.
The author of the script claims this is not a bash specific feature.
TBH Solaris doesn't have this bug either
>How-To-Repeat:
#!/usr/bin/sh

foobar=""
if test -n ""$foobar; then
         echo "Help, I am broken"
fi 
>Fix:

>Release-Note:
>Audit-Trail:

From: Tor Egge <Tor.Egge@idi.ntnu.no>
To: giffunip@asme.org
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: bin/6087: sh doesn't work properly on certain configuration scripts
Date: Sat, 21 Mar 1998 22:33:54 +0100

 ----Next_Part(Sat_Mar_21_22:32:09_1998)--
 Content-Type: Text/Plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 
 ash removes quoting information during parsing, thus the evaluation
 pass is not able to differentiate between
 
 	""$foobar
 
 and
 	$foobar
 
 
 This breaks proper handling of word splitting.  When $foobar expands
 to a single space, bash misbehaves too, for a slightly different
 reason.
 
 bash and ksh93 seems to perform word splitting differently:
 
 	( IFS="beh"; foobar="ghi"; echo "abc"abc$foobar "def"def )
 
 bash gives	abca cg i defdef
 
 ksh93 gives	abcabcg i defdef
 
 bash seems to follow POSIX 1003.2 draft 11.2 while ksh93 seems to
 follow spec1170 for this example.
 
 I'm using some patches that changes the word splitting handling for
 ash in an attempt to follow spec 1170 while not being bug compatible
 with ksh93.  Thus your test script does not complain when run on 
 my development system.
 
 A slightly bigger test script is appended here. It reveals some
 of the other anomalies in bash and ksh93.
 
 - Tor Egge
 
 ----Next_Part(Sat_Mar_21_22:32:09_1998)--
 Content-Type: Text/Plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 Content-Description: "sh-ifs-test"
 
 #!/bin/sh 
 
 echo "Tests of IFS handling and word splitting, v1.0 running"
 
 exec 2>&1
 
 if [ `echo -n | wc -l` = 0 ]
 then
   echo1="-n"
   echo2="--> "
   echo3=""
 else
   echo1=""
   echo2="--> \c"
   echo3="\c"
 fi
 
 echo '[OIFS="$IFS"]'
 OIFS="$IFS"
 
 # echo '[var="*"]'
 # var="*"
 # echo $echo1 '[echo $var]                 ' "$echo2"
 # echo $var
 # echo $echo1 '[echo "$var"]               ' "$echo2"
 # echo "$var"
 
 showargs() {
     XIFS="$IFS"
     IFS=" 	
 "
     for arg in "$@"
     do
       echo $echo1 "'$arg' $echo3"
     done
     echo
     IFS="$XIFS"
 }
 
 echo '[set abc "def ghi" jkl]'
 set abc "def ghi" jkl
 echo $echo1 '[showargs $*]               ' "$echo2"
 showargs $*
 echo $echo1 '[showargs "$*"]             ' "$echo2"
 showargs "$*"
 echo $echo1 '[showargs $@]               ' "$echo2"
 showargs $@
 echo $echo1 '[showargs "$@"]             ' "$echo2"
 showargs "$@"
 echo $echo1 '[showargs "xx$@yy"]         ' "$echo2"
 showargs "xx$@yy"
 echo $echo1 '[showargs "$@$@"]           ' "$echo2"
 showargs "$@$@"
 
 echo 'set "" abc "def ghi" "" jkl ""'
 set "" abc "def ghi" "" jkl ""
 echo $echo1 '[showargs $*]               ' "$echo2"
 showargs $*
 echo $echo1 '[showargs "$*"]             ' "$echo2"
 showargs "$*"
 echo $echo1 '[showargs $@]               ' "$echo2"
 showargs $@
 echo $echo1 '[showargs "$@"]             ' "$echo2"
 showargs "$@"
 echo $echo1 '[showargs "xx$@yy"]         ' "$echo2"
 showargs "xx$@yy"
 echo $echo1 '[showargs "$@$@"]           ' "$echo2"
 showargs "$@$@"
 
 echo '[IFS=""]'
 IFS=""
 
 echo 'set "" abc "def ghi" "" jkl ""'
 set "" abc "def ghi" "" jkl ""
 echo $echo1 '[showargs $*]               ' "$echo2"
 showargs $*
 echo $echo1 '[showargs "$*"]             ' "$echo2"
 showargs "$*"
 echo $echo1 '[showargs $@]               ' "$echo2"
 showargs $@
 echo $echo1 '[showargs "$@"]             ' "$echo2"
 showargs "$@"
 echo $echo1 '[showargs "xx$@yy"]         ' "$echo2"
 showargs "xx$@yy"
 echo $echo1 '[showargs "$@$@"]           ' "$echo2"
 showargs "$@$@"
 
 echo '[unset IFS]'
 unset IFS
 
 echo 'set "" abc "def ghi" "" jkl ""'
 set "" abc "def ghi" "" jkl ""
 echo $echo1 '[showargs $*]               ' "$echo2"
 showargs $*
 echo $echo1 '[showargs "$*"]             ' "$echo2"
 showargs "$*"
 echo $echo1 '[showargs $@]               ' "$echo2"
 showargs $@
 echo $echo1 '[showargs "$@"]             ' "$echo2"
 showargs "$@"
 echo $echo1 '[showargs "xx$@yy"]         ' "$echo2"
 showargs "xx$@yy"
 echo $echo1 '[showargs "$@$@"]           ' "$echo2"
 showargs "$@$@"
 
 echo '[IFS=":"]'
 IFS=":"
 
 echo 'set "" abc "def ghi" "" jkl ""'
 set "" abc "def ghi" "" jkl ""
 echo $echo1 '[showargs $*]               ' "$echo2"
 showargs $*
 echo $echo1 '[showargs "$*"]             ' "$echo2"
 showargs "$*"
 echo $echo1 '[showargs $@]               ' "$echo2"
 showargs $@
 echo $echo1 '[showargs "$@"]             ' "$echo2"
 showargs "$@"
 echo $echo1 '[showargs "xx$@yy"]         ' "$echo2"
 showargs "xx$@yy"
 echo $echo1 '[showargs "$@$@"]           ' "$echo2"
 showargs "$@$@"
 
 echo '[IFS=":$OIFS"]'
 IFS=":$OIFS"
 
 echo 'set "" abc "def ghi" "" jkl ""'
 set "" abc "def ghi" "" jkl ""
 echo $echo1 '[showargs $*]               ' "$echo2"
 showargs $*
 echo $echo1 '[showargs "$*"]             ' "$echo2"
 showargs "$*"
 echo $echo1 '[showargs $@]               ' "$echo2"
 showargs $@
 echo $echo1 '[showargs "$@"]             ' "$echo2"
 showargs "$@"
 echo $echo1 '[showargs "xx$@yy"]         ' "$echo2"
 showargs "xx$@yy"
 echo $echo1 '[showargs "$@$@"]           ' "$echo2"
 showargs "$@$@"
 
 echo '[IFS="$OIFS:"]'
 IFS="$OIFS:"
 
 echo 'set "" abc "def ghi" " : " jkl ""'
 set "" abc "def ghi" " : " jkl ""
 echo $echo1 '[showargs $*]               ' "$echo2"
 showargs $*
 echo $echo1 '[showargs "$*"]             ' "$echo2"
 showargs "$*"
 echo $echo1 '[showargs $@]               ' "$echo2"
 showargs $@
 echo $echo1 '[showargs "$@"]             ' "$echo2"
 showargs "$@"
 echo $echo1 '[showargs "xx$@yy"]         ' "$echo2"
 showargs "xx$@yy"
 echo $echo1 '[showargs "$@$@"]           ' "$echo2"
 showargs "$@$@"
 
 echo $echo1 '[showargs "" ab "" cd ef]   ' "$echo2"
 showargs "" ab "" cd ef
 
 echo '[A=""]'
 A=""
 echo $echo1 '[showargs ${A}]             ' "$echo2"
 showargs ${A}
 echo $echo1 '[showargs ${A}""]           ' "$echo2"
 showargs ${A}""
 echo $echo1 '[showargs ${A}X]            ' "$echo2"
 showargs ${A}X
 echo $echo1 '[showargs ""${A}]           ' "$echo2"
 showargs ""${A}
 echo $echo1 '[showargs X${A}]            ' "$echo2"
 showargs X${A}
 
 echo '[A=" "]'
 A=" "
 echo $echo1 '[showargs ${A}]             ' "$echo2"
 showargs ${A}
 echo $echo1 '[showargs ${A}""]           ' "$echo2"
 showargs ${A}""
 echo $echo1 '[showargs ${A}X]            ' "$echo2"
 showargs ${A}X
 echo $echo1 '[showargs ""${A}]           ' "$echo2"
 showargs ""${A}
 echo $echo1 '[showargs X${A}]            ' "$echo2"
 showargs X${A}
 
 echo '[A="  "]'
 A="  "
 echo $echo1 '[showargs ${A}]             ' "$echo2"
 showargs ${A}
 echo $echo1 '[showargs ${A}""]           ' "$echo2"
 showargs ${A}""
 echo $echo1 '[showargs ${A}X]            ' "$echo2"
 showargs ${A}X
 echo $echo1 '[showargs ""${A}]           ' "$echo2"
 showargs ""${A}
 echo $echo1 '[showargs X${A}]            ' "$echo2"
 showargs X${A}
 
 echo '[A=":"]'
 A=":"
 echo $echo1 '[showargs ${A}]             ' "$echo2"
 showargs ${A}
 echo $echo1 '[showargs ${A}""]           ' "$echo2"
 showargs ${A}""
 echo $echo1 '[showargs ${A}X]            ' "$echo2"
 showargs ${A}X
 echo $echo1 '[showargs ""${A}]           ' "$echo2"
 showargs ""${A}
 echo $echo1 '[showargs X${A}]            ' "$echo2"
 showargs X${A}
 echo '[A="X:"]'
 A="X:"
 echo $echo1 '[showargs ${A}]             ' "$echo2"
 showargs ${A}
 echo '[A="X :"]'
 A="X :"
 echo $echo1 '[showargs ${A}]             ' "$echo2"
 showargs ${A}
 echo '[A="X : "]'
 A="X : "
 echo $echo1 '[showargs ${A}]             ' "$echo2"
 showargs ${A}
 echo '[A="X: "]'
 A="X: "
 echo $echo1 '[showargs ${A}]             ' "$echo2"
 showargs ${A}
 
 echo '[A="::"]'
 A="::"
 echo $echo1 '[showargs ${A}]             ' "$echo2"
 showargs ${A}
 echo $echo1 '[showargs ${A}""]           ' "$echo2"
 showargs ${A}""
 echo $echo1 '[showargs ${A}X]            ' "$echo2"
 showargs ${A}X
 echo $echo1 '[showargs ""${A}]           ' "$echo2"
 showargs ""${A}
 echo $echo1 '[showargs X${A}]            ' "$echo2"
 showargs X${A}
 
 echo '[A="ab:c:"]'
 A="ab:c:"
 echo $echo1 '[showargs $A]               ' "$echo2"
 showargs $A
 echo '[A="ab:  c:"]'
 A="ab:  c:"
 echo $echo1 '[showargs $A]               ' "$echo2"
 showargs $A
 echo '[A="ab : c:"]'
 A="ab : c:"
 echo $echo1 '[showargs $A]               ' "$echo2"
 showargs $A
 echo '[A="ab   c:"]'
 A="ab   c:"
 echo $echo1 '[showargs $A]               ' "$echo2"
 showargs $A
 echo '[A="a   b:c:"]'
 A="a   b:c:"
 echo $echo1 '[showargs $A]               ' "$echo2"
 showargs $A
 echo '[A="a:b:c:"]'
 A="a:b:c:"
 echo $echo1 '[showargs $A]               ' "$echo2"
 showargs $A
 echo '[A="a  :b:c:"]'
 A="a  :b:c:"
 echo $echo1 '[showargs $A]               ' "$echo2"
 showargs $A
 echo '[A="a : b:c:"]'
 A="a : b:c:"
 echo $echo1 '[showargs $A]               ' "$echo2"
 showargs $A
 echo '[A="a:  b:c:"]'
 A="a:  b:c:"
 echo $echo1 '[showargs $A]               ' "$echo2"
 showargs $A
 echo '[A="a:  b c:"]'
 A="a:  b c:"
 echo $echo1 '[showargs $A]               ' "$echo2"
 showargs $A
 
 echo '[A="a b  c  d    e"]'
 A="a b  c  d    e"
 echo $echo1 '[showargs $A]               ' "$echo2"
 showargs $A
 
 echo $echo1 '[showargs "$A"]             ' "$echo2"
 showargs "$A"
 
 echo '[A="   a b  c  d    e   "]'
 A="   a b  c  d    e   "
 echo $echo1 '[showargs $A]               ' "$echo2"
 showargs $A
 
 echo '[A=":a b  c  d  ::  e:"]'
 A=":a b  c  d  ::  e:"
 echo $echo1 '[showargs $A]               ' "$echo2"
 showargs $A
 echo $echo1 '[echo $A]                   ' "$echo2"
 echo $A
 echo '[A=":a b  c  d  ::  f::"]'
 A=":a b  c  d  ::  f::"
 echo $echo1 '[showargs $A]               ' "$echo2"
 showargs $A
 echo $echo1 '[echo $A]                   ' "$echo2"
 echo $A
 
 echo '[A=":"]'
 A=":"
 echo $echo1 '[showargs X${A}Y${A}X]      ' "$echo2"
 showargs X${A}Y${A}X
 echo $echo1 '[showargs X${A}${A}X]       ' "$echo2"
 showargs X${A}${A}X
 echo $echo1 '[showargs X${A}]            ' "$echo2"
 showargs X${A}
 echo $echo1 '[showargs X${A}${A}]        ' "$echo2"
 showargs X${A}${A}
 echo $echo1 '[showargs ${A}X]            ' "$echo2"
 showargs ${A}X
 echo $echo1 '[showargs ${A}${A}X]        ' "$echo2"
 showargs ${A}${A}X
 
 echo '[A="::"]'
 A="::"
 echo $echo1 '[showargs X${A}Y${A}X]      ' "$echo2"
 showargs X${A}Y${A}X
 echo $echo1 '[showargs X${A}${A}X]       ' "$echo2"
 showargs X${A}${A}X
 echo $echo1 '[showargs X${A}]            ' "$echo2"
 showargs X${A}
 echo $echo1 '[showargs X${A}${A}]        ' "$echo2"
 showargs X${A}${A}
 echo $echo1 '[showargs ${A}X]            ' "$echo2"
 showargs ${A}X
 echo $echo1 '[showargs ${A}${A}X]        ' "$echo2"
 showargs ${A}${A}X
 
 echo '[A=" ::"]'
 A=" ::"
 echo $echo1 '[showargs X${A}Y${A}X]      ' "$echo2"
 showargs X${A}Y${A}X
 echo $echo1 '[showargs X${A}${A}X]       ' "$echo2"
 showargs X${A}${A}X
 echo $echo1 '[showargs X${A}]            ' "$echo2"
 showargs X${A}
 echo $echo1 '[showargs X${A}${A}]        ' "$echo2"
 showargs X${A}${A}
 echo $echo1 '[showargs ${A}X]            ' "$echo2"
 showargs ${A}X
 echo $echo1 '[showargs ${A}${A}X]        ' "$echo2"
 showargs ${A}${A}X
 
 echo '[A="ab     "]'
 A="ab     "
 echo 'B="     cde"]'
 B="     cde"
 
 echo $echo1 '[showargs $A$B]             ' "$echo2"
 showargs $A$B
 
 echo '[A="ab     :"]'
 A="ab     :"
 echo '[B="     cde"]'
 B="     cde"
 
 echo $echo1 '[showargs $A$B]             ' "$echo2"
 showargs $A$B
 
 echo $echo1 '[showargs ${A}X]            ' "$echo2"
 showargs ${A}X
 
 echo $echo1 '[echo "a:b:c"]              ' "$echo2"
 echo "a:b:c"
 
 echo $echo1 '[echo "a:b\:c"]             ' "$echo2"
 echo "a:b\:c"
 
 echo $echo1 '[echo a:b:c]                ' "$echo2"
 echo a:b:c
 
 echo $echo1 '[echo a:b\:c]               ' "$echo2"
 echo a:b\:c
 
 echo $echo1 '[echo a:b:c":d:e:f"]        ' "$echo2"
 echo a:b:c":d:e:f"
 
 echo $echo1 '[echo a:b\:c":d:e\:f"]      ' "$echo2"
 echo a:b\:c":d:e\:f"
 
 echo '[var="val:val2\:val3"]'
 var="val:val2\:val3"
 
 echo '[xvar=":val:val2\:val3"]'
 xvar=":val:val2\:val3"
 
 echo $echo1 '[echo $novar:b:c]           ' "$echo2"
 echo $novar:b:c
 
 echo $echo1 '[echo $xvar]                ' "$echo2"
 echo $xvar
 
 echo $echo1 '[echo "$var:b:c"]           ' "$echo2"
 echo "$var:b:c"
 
 echo $echo1 '[echo "$var:b\:c"]          ' "$echo2"
 echo "$var:b\:c"
 
 echo $echo1 '[echo $var:b:c]             ' "$echo2"
 echo $var:b:c
 
 echo $echo1 '[echo $var:b\:c]            ' "$echo2"
 echo $var:b\:c
 
 echo $echo1 '[echo $var:b:c":$var:e:f"]  ' "$echo2"
 echo $var:b:c":$var:e:f"
 
 echo $echo1 '[echo $var:b\:c":$var:e\:f"]' "$echo2"
 echo $var:b\:c":$var:e\:f"
 
 echo $echo1 '[echo $var:`echo '\''h:i'\''`]    ' "$echo2"
 echo $var:`echo 'h:i'`
 
 echo $echo1 '[echo $var:"`echo '\''h:i'\''`"]  ' "$echo2"
 echo $var:"`echo 'h:i'`"
 
 echo '[IFS="${OIFS}a"]'
 IFS="${OIFS}a"
 echo '[HOME="harmless"]'
 HOME="/harmless"
 
 echo $echo1 '[echo ~]                    ' "$echo2"
 echo ~
 
 echo $echo1 '[echo ~/$var]               ' "$echo2"
 echo ~/$var
 
 echo $echo1 '[echo ~root]                ' "$echo2"
 echo ~root
 
 echo $echo1 '[echo ~roo'\''t'\'']              ' "$echo2"
 echo ~roo't'
 
 echo $echo1 '[echo ~roo"t"]              ' "$echo2"
 echo ~roo"t"
 
 echo $echo1 '[echo ~root\/]              ' "$echo2"
 echo ~root\/
 
 echo $echo1 '[echo \~root]               ' "$echo2"
 echo \~root
 
 echo $echo1 '[echo "~"root]              ' "$echo2"
 echo "~"root
 
 echo $echo1 '[echo var:bad:bad]          ' "$echo2"
 echo var:bad:bad
 
 echo $echo1 '[echo $var:bad:bad]         ' "$echo2"
 echo $var:bad:bad
 
 echo $echo1 '[echo $var:bad:"bad"]       ' "$echo2"
 echo $var:bad:"bad"
 
 echo $echo1 '[echo $var:bad:'\''bad'\'']       ' "$echo2"
 echo $var:bad:'bad'
 
 if [ ! `echo "$((4+4))"` = 8 ]
 then
    echo "Extended syntax not supported."	
    exit 0
 fi
 
 echo '[IFS="${OIFS}:"]'
 IFS="${OIFS}:"
 echo $echo1 '[echo $var:$(echo '\''f:g'\'')]   ' "$echo2"
 echo $var:$(echo 'f:g')
 
 echo $echo1 '[echo $var:"$(echo '\''f:g'\'')"] ' "$echo2"
 echo $var:"$(echo 'f:g')"
 
 echo $echo1 '[echo $var:$((4+4))]        ' "$echo2"
 echo $var:$((4+4))
 
 echo '[IFS="${OIFS}6"]'
 IFS="${OIFS}6"
 echo $echo1 '[echo 262144:$((13*13))]    ' "$echo2"
 echo 262144:$((13*13))
 
 echo $echo1 '[echo 262144":$((13*13))"]  ' "$echo2"
 echo 262144":$((13*13))"
 
 # No shells seems to support this construct, due to separate passes
 # for parsing and evaluation:
 # 		echo "$((4+`echo '4))'`"
 # If parsing was performed during evaluation, the result could be
 # "$((4+`echo '4))'`"   (initial state)
 # "$((4+`echo '4))'`"   (after tilde expansion)
 # "$((4+`echo '4))'`"   (after parameter expansion)
 # "$((4+4))"		(after command substitution)
 # "8"			(after arithmetic expansion)
 # "8"			(after field splitting)
 # "8"			(after pathname expansion)
 # 8			(after quote removal)
 
 
 ----Next_Part(Sat_Mar_21_22:32:09_1998)----

From: Martin Cracauer <cracauer@cons.org>
To: giffunip@asme.org
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: bin/6087: sh doesn't work properly on certain configuration scripts
Date: Sun, 22 Mar 1998 01:07:04 +0100

 In <199803211955.LAA15097@hub.freebsd.org>, giffunip@asme.org wrote: 
 > While using a configure script a problem with FreeBSD's sh was revealed.
 > The author of the script claims this is not a bash specific feature.
 > TBH Solaris doesn't have this bug either
 > >How-To-Repeat:
 > #!/usr/bin/sh
 > 
 > foobar=""
 > if test -n ""$foobar; then
 >          echo "Help, I am broken"
 > fi 
 
 Our /bin/sh expands ""$foobar to nothing, not to the empty string. I
 can't really judge over this, but it seems obvious that it should be
 the empty string and that we need to fix this.
 
 But there's another "interesting" detail in here: What does `test -n`
 return when no additional argument is passed? 
 
 FreeBSD's /bin/test (and bash2's) is supposed to support a call syntax 
 	test string
 without any option switch, which is supposed to return true if strings
 is not an empty string. That way, '-n' without an argument can be
 considered a non-empty string passed without option keys and true can
 be returned, which is what it does for now.
 
 ~(waldstrasse)44% bash -c 'test "" ; echo $?'
 1
 ~(waldstrasse)45% bash -c 'test "n" ; echo $?'
 0
 ~(waldstrasse)46% bash -c 'test "-n" ; echo $?'
 0
 ~(waldstrasse)47% bash -c 'test "-n" ""; echo $?'
 1
 ~(waldstrasse)48% bash -c 'test "-n" "n"; echo $?'
 0
 
 FreeBSD's /bin/test returns the same.
 
 Solaris' removed the non-switch syntax from from the manpage for
 /bin/test, while the actual program still supports it (Solaris
 2.5). If the string is what could be a switch, it is considered an
 error to be called with no additional argument. This is for the
 external program /bin/test, which is really an alias for /bin/ksh. You
 won't beleive how slow it is...
 
 ~(waldstrasse)32% /bin/test "" ; echo $?
 1
 ~(waldstrasse)33% /bin/test "n" ; echo $?
 0
 ~(waldstrasse)34% /bin/test "-n" ; echo $?
 /bin/test[8]: test: argument expected
 2
 ~(waldstrasse)35% /bin/test "-n" ""; echo $?
 1
 ~(waldstrasse)36% /bin/test "-n" "n"; echo $?
 0
 
 
 To make things worse, there is a bug in Solaris' /bin/sh built-in test:
 
 The intended behaviour seems to be exactly the same as for
 /bin/test. But it has a bug in that the whole script is terminated
 when `test -n` fails, see the third test, the echo command isn't
 executed. Someone obviously does an exit(1) here...
 
 ~(waldstrasse)22% /bin/sh -c 'test "" ; echo $?'
 1
 ~(waldstrasse)23% /bin/sh -c 'test "n" ; echo $?'
 0
 ~(waldstrasse)24% /bin/sh -c 'test "-n" ; echo $?'
 /bin/sh: test: argument expected
 ~(waldstrasse)25% /bin/sh -c 'test "-n" ""; echo $?'
 1
 ~(waldstrasse)26% /bin/sh -c 'test "-n" "n"; echo $?'
 0
 
 Could someone please look up the Posix standard for test(1)?
 
 I'm working on other syntax bugs of FreeBSD's /bin/sh and will add the
 expansion issue from above, but I can't promise anything soon. This is
 a very difficult area. For every sh bug in a given Unix clone you can
 bet that many places in the same OS depend on it.
 
 Martin
 -- 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer
 BSD User Group Hamburg, Germany     http://www.bsdhh.org/
State-Changed-From-To: open->closed 
State-Changed-By: cracauer 
State-Changed-When: Wed Sep 16 23:58:03 MEST 1998 
State-Changed-Why:  
Fixed by Tor Egge in -current. 
>Unformatted:
