[BusyBox 0006284]: printenv does not return with error exitcode when a variable is not found (mismatch with coreutils)

bugs at busybox.net bugs at busybox.net
Tue Nov 11 21:50:12 UTC 2008


The following issue has been SUBMITTED. 
====================================================================== 
http://busybox.net/bugs/view.php?id=6284 
====================================================================== 
Reported By:                pgbovine
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   6284
Category:                   Standards Compliance
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             11-11-2008 13:50 PST
Last Modified:              11-11-2008 13:50 PST
====================================================================== 
Summary:                    printenv does not return with error exitcode when a
variable is not found (mismatch with coreutils)
Description: 
>From 'info printenv':

   Exit status:

     0 if all variables specified were found
     1 if at least one specified variable was not found
     2 if a write error occurred

If coreutils doesn't find a particular environment variable (given as
command-line arg), then it will return exitcode 1, whereas busybox simply
still returns 0, which goes against the spec above.

Coreutils:

$ printenv blahblah
$ echo $?
1

(environment variable 'blahblah' not found, so returns 1)

$ printenv _ blahblah
/usr/bin/printenv
$ echo $?
1

(Note that the _ variable returns the name of the currently-executing
program, so it is found, but 'blahblah' is still not found, so still
returns 1.)

Busybox:
$ ./busybox printenv blahblah
$ echo $?
0

pgbovine at hexapod ~/busybox
$ ./busybox printenv _ blahblah
./busybox
$ echo $?
0

Exits with 0 even though 'blahblah' was not found.

====================================================================== 

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




More information about the busybox-cvs mailing list