Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [bug?] test adf -ge 0



On Tue, 2004-08-31 at 12:11, Dan Nelson wrote:
> Probably because atoi("sdf") returns 0, so the test succeeds.
Indeed, without errno being set too, as you are probably aware.

FreeBSD(likely, NetBSD as well) uses strtol, which is how they catch the
error.

> /bin/sh on Tru64 5.1, AIX 5.2, and Solaris 9 all succeed.
Wow, just when I thought I was writing portable scripts! /;

> It's probably in the range of "undefined behaviour".  I can't find any
> manpages or standards docs that say that test must verify that numeric
> arguments are really numbers.
I looked at what OpenGroup.org had, but nothing regarding the subject
seemed to be specified.

http://www.opengroup.org/onlinepubs/009695399/utilities/test.html

This doesn't match up to the version FreeBSD's test is said to comply
to, so I don't know for sure if FreeBSD's test is complying specified
behaviour or just historic on BSDs. =\

-- 
Regards,
        James William Pye

Attachment: signature.asc
Description: This is a digitally signed message part



Messages sorted by: Reverse Date, Date, Thread, Author