[BusyBox 0006304]: expr returns exitcode of 0 for certain variants of '0' (mismatch with coreutils)
bugs at busybox.net
bugs at busybox.net
Tue Nov 11 22:01:22 UTC 2008
The following issue has been SUBMITTED.
======================================================================
http://busybox.net/bugs/view.php?id=6304
======================================================================
Reported By: pgbovine
Assigned To: BusyBox
======================================================================
Project: BusyBox
Issue ID: 6304
Category: Standards Compliance
Reproducibility: always
Severity: minor
Priority: normal
Status: assigned
======================================================================
Date Submitted: 11-11-2008 14:01 PST
Last Modified: 11-11-2008 14:01 PST
======================================================================
Summary: expr returns exitcode of 0 for certain variants of
'0' (mismatch with coreutils)
Description:
>From 'info expr':
Exit status:
0 if the expression is neither null nor 0,
1 if the expression is null or 0,
expr should return 1 if the expression is '0'. coreutils thinks that
anything with a series of zeroes, even followed by leading dashes,
qualifies as '0' and thus returns 1 for all of these variants:
$ expr '0'
0
$ echo $?
1
$ expr '-0'
-0
$ echo $?
1
$ expr '00'
00
$ echo $?
1
$ expr '-00'
-00
$ echo $?
1
However, busybox only thinks that the literal '0' alone qualifies as 0:
$ ./busybox expr '0'
0
$ echo $?
1
and other variants don't qualify as '0', so it returns an exitcode of 0
rather than 1 (sorry if this is semi-confusing, but it's in the specs):
$ ./busybox expr '-0'
-0
$ echo $?
0
$ ./busybox expr '00'
00
$ echo $?
0
$ ./busybox expr '-00'
-00
$ echo $?
0
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
11-11-08 14:01 pgbovine New Issue
11-11-08 14:01 pgbovine Status new => assigned
11-11-08 14:01 pgbovine Assigned To => BusyBox
======================================================================
More information about the busybox-cvs
mailing list