No subject


Mon Nov 10 21:43:42 UTC 2008


   Exit status:

     0 if the expression is neither null nor 0,
     1 if the expression is null or 0,
     2 if the expression is invalid,
     3 if an internal error occurred (e.g., arithmetic overflow).

Busybox overloads exitcode 1 both to signify a successful exit with a
'false' value and to signify a syntax error. In contrast, coreutils uses a
special exit code 2 to signify a syntax error.

Coreutils:
$ expr '1' '<' '0'
0
$ echo $?
1

(this expression is valid and FALSE, so coreutils properly returns an
exitcode of 1)

$ expr '<' '0'
expr: syntax error
$ echo $?
2

(this expression is INVALID, so coreutils properly returns an exitcode of
2)

Busybox:
$ ./busybox expr '1' '<' '0'
0
$ echo $?
1

(so far, so good)

$ ./busybox expr '<' '0'
expr: syntax error
$ echo $?
1

(uh oh, should return exitcode of 2 here rather than 1.)
====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
11-11-08 13:55  pgbovine       New Issue                                    
11-11-08 13:55  pgbovine       Status                   new => assigned     
11-11-08 13:55  pgbovine       Assigned To               => BusyBox         
======================================================================



More information about the busybox-cvs mailing list