9fans archive / 1996 / 02 / 8 /    prev next

From: Dave Presotto presotto@pla...
Subject: mistakes in test(1)
Date: Wed, 7 Feb 1996 04:21:26 -0500

right you are.  I fixed the CHDIR arbitrarily differently.
Boddle is http://plan9.att.com/plan9/update/cmd/test.rc

------ forwarded message follows ------

>From cse.psu.edu!9fans-outgoing-owner Wed Feb  7 10:17:09 EST 1996
Received: from colossus.cse.psu.edu by plan9; Wed Feb  7 10:17:09 EST 1996
Received: by colossus.cse.psu.edu id <78354>; Wed, 7 Feb 1996 09:56:25 -0500
Received: from hamnavoe.demon.co.uk ([158.152.225.204]) by colossus.cse.psu.edu with SMTP id <78352>; Wed, 7 Feb 1996 09:55:54 -0500
From:	hamnavoe.demon.co.uk!miller
To:	cse.psu.edu!9fans
Date:	Wed, 7 Feb 1996 07:21:15 -0500
Subject: mistakes in test(1)
Message-Id: <96Feb7.095554est.78352@col...>
Sender: cse.psu.edu!owner-9fans
Precedence: bulk
Reply-To: cse.psu.edu!9fans

I think there are two errors in the implementation of the test command,
as shown by the following examples:

	if (test -d . -a ! -f .) echo OK
	if (test ! ! -d .) echo OK

A suggested correction:

diff /sys/src/cmd/test.c test.c

86c86
<               return(!e3());
---
>               return(!e2());
193c193
<       return(dir.mode&CHDIR);
---
>       return((dir.mode&CHDIR)!=0);

--
Richard Miller <miller@ham...>
18 Lathbury Road, Oxford OX2 7AU, England