[BusyBox 0000947]: The order of variable evaluation by bash's implementation of /bin/sh differs from normal /bin/sh

bugs at busybox.net bugs at busybox.net
Fri Jul 14 16:02:27 UTC 2006


The following issue has been SUBMITTED. 
====================================================================== 
http://busybox.net/bugs/view.php?id=947 
====================================================================== 
Reported By:                anthony
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   947
Category:                   Standards Compliance
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             07-14-2006 09:02 PDT
Last Modified:              07-14-2006 09:02 PDT
====================================================================== 
Summary:                    The order of variable evaluation by bash's
implementation of /bin/sh differs from normal /bin/sh
Description: 
For the command
  X=usbdev X=${X#usbdev} B=${X%%.*} D=${X#*.}; echo bus/usb/$B/$D

On the normal /bin/sh, the result is:
  bus/usb/1/2

On busybox's /bin/sh, the result is:
  bus/usb//

To get the same result you need to modify the command to:
  X=usbdev; X=${X#usbdev}; B=${X%%.*} D=${X#*.}; echo bus/usb/$B/$D

This seems to be a difference in the way the two shells evaluate
variables, and means that some scripts when copied from a standard
environment to a busybox environment may fail unexpectedly. (I picked this
up when copying udev rules into an initramdisk that uses busybox).

This is true for all versions of busy box from 1.1.2 to the current
development version.
====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
07-14-06 09:02  anthony        New Issue                                    
07-14-06 09:02  anthony        Status                   new => assigned     
07-14-06 09:02  anthony        Assigned To               => BusyBox         
======================================================================




More information about the busybox-cvs mailing list