bin/155786: '/bin/test -d' fails to report syntax error

Jim Pirzyk pirzyk at FreeBSD.org
Tue Mar 22 16:00:06 UTC 2011


	Note: There was a bad value `no=20' for the field `>Confidential:'.
	It was set to the default value of `yes'.


>Number:         155786
>Category:       bin
>Synopsis:       '/bin/test -d' fails to report syntax error
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 22 16:00:05 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Jim Pirzyk
>Release:        FreeBSD 8.2-RELEASE amd64
>Organization:
=09
>Environment:
System: FreeBSD freebsd.home.pirzyk.org 8.2-RELEASE FreeBSD 8.2-RELEASE =
#0: Thu Feb 17 02:41:51 UTC 2011 =
root at mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64

>Description:
	Running the command '/bin/test -d' does not report a syntax =
error, like it
	does on Solaris systems.

>How-To-Repeat:
	FreeBSD $ /bin/test -d; echo $?
	0

	Solaris $ /bin/test -d ; echo $?
	ksh: test: argument expected
	2

>Fix:

- --- ./bin/test/test.c.orig	2011-02-27 14:02:10.000000000 -0500
+++ ./bin/test/test.c	2011-03-22 11:35:03.000000000 -0400
@@ -424,12 +424,12 @@
 	}
 	while (op->op_text) {
 		if (strcmp(s, op->op_text) =3D=3D 0) {
+			t_wp_op =3D op;
 			if (((op->op_type =3D=3D UNOP || op->op_type =3D=3D=
 BUNOP)
 						&& isunopoperand()) ||
 			    (op->op_num =3D=3D LPAREN && =
islparenoperand()) ||
 			    (op->op_num =3D=3D RPAREN && =
isrparenoperand()))
- -				break;
- -			t_wp_op =3D op;
+				syntax(t_wp_op->op_text, "argument =
expected");
 			return op->op_num;
 		}
 		op++;

- --- @(#) $Id: dot.signature,v 1.15 2007/12/27 15:06:13 pirzyk Exp $
    __o  jim at pirzyk.org =
--------------------------------------------------
 _'\<,_
(*)/ (*) I'd rather be out biking.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)

iQEVAwUBTYjHHBMKjZgDurkjAQJJ5AgAzYuq5LGcQBbXuyDrqHlrekAqfa8aO9Nm
5r3NpQwewYdkHUCY+zQFjht+k3/ykahQVX9dUrjDnh1Xr129lApFz8Rq3p6YGdCl
wlPJIwUREqJQ4rdqVRLOdBcwapPD2ITq8CHWuQ4vhb9NqjNOcMHptLA4ym21e1bk
ItCCX/2jLzQ3qT5Cm5O6WRlQUOK+vbkLfoogOny5iG9oeDxRCTo4dd963/NnVFUX
VYwLs+265x6wQ7feXYjl9pZ/C9/INkhHqkRbd2ps5njJev9KmEFLYwEGJNhGMsFL
Ld6DvJIJaMuO4LP5PgUEL0qVHg9B9aEqrjsbT/uamfx7qhpOLSB4Rg=3D=3D
=3DGGqm
-----END PGP SIGNATURE-----
>Release-Note:
>Audit-Trail:
>Unformatted:
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 


More information about the freebsd-bugs mailing list