[Bug 845] New: ASH fails to handle semi-complex "test"

bugzilla at busybox.net bugzilla at busybox.net
Thu Jan 7 18:08:42 UTC 2010


https://bugs.busybox.net/show_bug.cgi?id=845

           Summary: ASH fails to handle semi-complex "test"
           Product: Busybox
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
        AssignedTo: unassigned at busybox.net
        ReportedBy: mykesmith1 at gmail.com
                CC: busybox-cvs at busybox.net
   Estimated Hours: 0.0


Encountered this problem in running Oprofile's control script (opcontrol) on
BusyBox 1.11.2.

This shows up when you use the single character option, for instance  "-d"
instead of the "--dump" option. The problem occurs when you do

if test -z "$2" -a "$1" = "--reset";  then

running with -xv option I see using the "-d" option

+ test -z  -a -d = --reset                        <<<<<<<<<< $2  evaluates to
null, $1 evaluates to -d
sh: --reset: unknown operand          
+ load_module

running with -xv option I see using the "--dump" option

+ test -z  -a --dump = --reset                <<<<<<<<<< $2 evaluates  to null,
$1 evaluates to --dump
+ load_module

I tried as an alternative

if [  \( -z "$2"\) -a \("$1" = "--reset" \) ]; then

but using either the -d or --dump option I got
+ [ ( -z ) -a (-d = --reset) ]
sh: closing paren expected      

The only workaround that works is:

 if test \( -z "$2"\) -a \("$1" = "--reset" \) ; then

+ test ( -z ) -a (-d = --reset )                 <<<<<<<<<< $2  evaluates to
null, $1 evaluates to -d
+ load_module

+ test ( -z ) -a (--dump = --reset )      <<<<<<<<<< $2  evaluates to null, $1
evaluates to --dump
+ load_module


-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list