BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000947 [BusyBox] Standards Compliance minor always 07-14-06 09:02 02-15-08 07:02
Reporter anthony View Status public  
Assigned To BusyBox
Priority normal Resolution fixed  
Status closed   Product Version 1.2.x
Summary 0000947: 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.
Additional Information
Attached Files

- Relationships

- Notes
(0001549)
anthony
07-28-06 04:30

For some reason the commands are incorrect, they should be:

X=usbdev1.2 X=${X#usbdev} B=${X%%.*} D=${X#*.}; echo bus/usb/$B/$D

followed by

X=usbdev1.2; X=${X#usbdev}; B=${X%%.*} D=${X#*.}; echo bus/usb/$B/$D
 
(0004884)
vda
02-15-08 07:02

Fixed in revision 21030. Thanks!
 

- 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
07-28-06 04:30 anthony Note Added: 0001549
02-15-08 07:02 vda Status assigned => closed
02-15-08 07:02 vda Note Added: 0004884
02-15-08 07:02 vda Resolution open => fixed


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker