From owner-freebsd-stable Tue Dec 28 3:35:20 1999 Delivered-To: freebsd-stable@freebsd.org Received: from grisu.bik-gmbh.de (grisu.bik-gmbh.de [194.233.237.82]) by hub.freebsd.org (Postfix) with ESMTP id 6E96D14FBC for ; Tue, 28 Dec 1999 03:35:16 -0800 (PST) (envelope-from cracauer@counter.bik-gmbh.de) Received: from counter.bik-gmbh.de (counter.bik-gmbh.de [194.233.237.131]) by grisu.bik-gmbh.de (8.9.3/8.9.3) with ESMTP id MAA21088; Tue, 28 Dec 1999 12:35:11 +0100 (MET) Received: (from cracauer@localhost) by counter.bik-gmbh.de (8.9.3/8.8.8) id MAA38223; Tue, 28 Dec 1999 12:34:35 +0100 (CET) (envelope-from cracauer) Date: Tue, 28 Dec 1999 12:34:35 +0100 From: Martin Cracauer To: Marcin Cieslak Cc: freebsd-stable@FreeBSD.ORG Subject: Re: /bin/test broken ? Message-ID: <19991228123435.A37738@cons.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.4i In-Reply-To: ; from Marcin Cieslak on Thu, Dec 23, 1999 at 02:30:19PM +0100 Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In , Marcin Cieslak wrote: > On Thu, 23 Dec 1999, Eric D. Futch wrote: > > > -stable as of Wed Dec 22 01:48:17 EST 1999 dosen't seem to have this > > problem. > > > > % /bin/test 1 -ne 0 ] > > test: ]: unexpected operator > > Recent -stable: > > $ /bin/test 1 -ne 0 ] > test: syntax error > $ [ 1 -ne 0 ] > $ > > but on Solaris 2.5 in both sh and ksh: > > $ /bin/test 1 -ne 0 ] > $ [ 1 -ne 0 ] Posix makes it clear that `test -n` without further arguments should be interpreted as "yes, there is a string with length > 0, and it is a dash and an n". Solaris violates this rule, amoung other problems. Also, try this on Solaris: sh -c 'test -n ; echo This must appear no matter what the former did' ksh -c 'test -n ; echo This must appear no matter what the former did' Probably caused by a shared source for standalone test(1) and sh's test(1). Someone calls exit() on error in test(1), and doesn't take into account that it may be builtin in sh. See also http://www3.cons.org/cracauer/bourneshell.html under "Fun with test -n". This is a beta-test page, feedback welcome. Martin -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer http://www.bik-gmbh.de/~cracauer/ "Where do you want to do today?" Hard to tell running your calendar program on a junk operating system, eh? To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message