bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [coreutils] Re: expr option interpretation changes


From: Pádraig Brady
Subject: Re: [coreutils] Re: expr option interpretation changes
Date: Tue, 14 Oct 2008 23:04:28 +0100
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Nelson H. F. Beebe wrote:
> I agree with a previous poster that the altered behaviour of expr in
> coreutils-7.0 as a result of using getopt() for option parsing is
> acceptable, and consistent with many other utilities, and with GNU and
> POSIX interpretation of a double-hyphen option.

I don't agree

> Here is another problem area with expr (in general, not just the GNU
> version).  Consider these two similar cases:
> 
>       expr -1 + 3
>       expr ' -1' + 3
> 
> To a human, both of these should evaluate to 2.
> 
> Apple Mac OS X, DEC Alpha OSF/1, OpenBSD, Sun Solaris 10, SGI IRIX
> native expr, and GNU/coreutils 7.0 produce 2 for the first, but
> complain "expr: non-numeric argument:" for the second.

That's what I would expect.
Note that the old and current coreutils produce the same
output for the examples above. But expanding it slightly
shows where the changes in coreutils 7.0 are questionable:

$ ./expr-7.0 -11 + 3
./expr: syntax error
$ expr-6.9 -11 + 3
-8

[minix & *BSD madness elided]

thanks for checking all these systems BTW.
That's great info to have.

I didn't post a patch as James may like to address this.
I'll post something tomorrow if not.

cheers,
Pádraig.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]