From owner-freebsd-standards@FreeBSD.ORG Tue Sep 7 14:17:53 2004 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1424D16A4CE for ; Tue, 7 Sep 2004 14:17:53 +0000 (GMT) Received: from rhid.com (rhid.com [200.46.204.134]) by mx1.FreeBSD.org (Postfix) with ESMTP id CB40143D46 for ; Tue, 7 Sep 2004 14:17:52 +0000 (GMT) (envelope-from flaw@rhid.com) Received: from [127.0.0.1] (rhid.com [200.46.204.134]) by rhid.com (Postfix) with ESMTP id 767BDF84D2F; Tue, 7 Sep 2004 15:17:42 +0100 (BST) From: James William Pye To: FreeBSD Standards Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-vnjDFZ++OAcpD3br6Rx3" Organization: rhid development Message-Id: <1094566670.80264.78.camel@localhost> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Tue, 07 Sep 2004 07:17:51 -0700 cc: Dan Nelson Subject: /bin/test asdf -ge 0 X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2004 14:17:53 -0000 --=-vnjDFZ++OAcpD3br6Rx3 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable FreeBSD's test--and likely BSD's in general--use strtol to parse number strings to catch errors. Other shells and test implementations do not. zsh, pdksh, and, allegedly, GNU's test being notable implementations that more than likely use atoi, which just renders 0 for strings that don't make sense to it. That is, test asdf -ge 0 succeeds in some shells, and fails in others. I am curious if anyone knows if this behavior conforms to a specification. Personally, I find FreeBSD's behavior "correct", so I find the implementation differences disturbing. If it is conforming to a specification, I think it would be possible to convince some developers to change their implementations, which would be a good thing(tm). I first noticed this when zsh did not give me an error on test asdf -ge 0. I contacted the zsh developers about the apparent behavioral error, and Dan Nelson responded with examples of other shells that do the same thing("/bin/sh on Tru64 5.1, AIX 5.2, and Solaris 9 all succeed."). (I sent in my report after checking only /bin/sh and bash. =3D\) In short, does anyone know if this behavior conforms to a specification or does it fall into the range of "undefined behavior" that Dan figured it is in? (I'm betting on what Dan figured, but I wanted to check with standards to see if anyone else could confirm it). test(1) says it "implements a superset of the IEEE Std 1003.2", which I'm not sure if that's the same thing as or part of what's accessible at unix.org. --=20 Regards, James William Pye --=-vnjDFZ++OAcpD3br6Rx3 Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (FreeBSD) iQEVAwUAQT3DDqZpiPNPvu8yAQL3Swf/fMBsIY/ZFWyailyDOgLHCI3Xu8kPtAwl uOwAGjjXp1XxbKQZ2WbX19jUEhjpQd/Vt+8vFw7xRY8OIsvNFiul2otZwSHO5Z5L 2vDNIfaendZXzXEdwDibWNYPuzCmNzUSe0Z9JPtphq3EsbWA1g6E20zGsNsFAibj Uw/Qdtca3uQbMlSuzbl9wSWZDRXA1n211314pOrHtqm0OjrMnnS5AluLe4Yy57us GosuHp3waiBjvv9KwB6P4AUm/G7b01UZm8pgJGT/NbCLxmRIXkQBr/lUl/rRP8Gn 3J2SSRkTtC1rVdZbcCE7O+472tIQOr2JTveAn3/UILtGqgcOhUPjFw== =7Caq -----END PGP SIGNATURE----- --=-vnjDFZ++OAcpD3br6Rx3--