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
0000152 [BusyBox] Other major always 03-14-05 04:12 07-31-05 15:34
Reporter srowe View Status public  
Assigned To BusyBox
Priority normal Resolution fixed  
Status closed   Product Version 1.00
Summary 0000152: ash: quoting rules for local variables different to globals
Description bash (and ash in 0.60) are happy with both

    var=`echo "a b c"`
    local var=`echo "a b c"`

(notice no double quotes around expression even though it expands to multiple words.

ash in 1.0 requires quotes, but only for local variable declarations. The attached file produces

    # sh test.sh
    this does work
    this

bash 2.05b produces

    # sh /tmp/test.sh
    this does work
    this should work

Additional Information
Attached Files  test.sh [^] (105 bytes) 03-14-05 04:12
 ash-local-fix.diff [^] (1,823 bytes) 04-28-05 06:03
 ifs.sh [^] (219 bytes) 07-20-05 00:58
 ifs.out [^] (230 bytes) 07-20-05 01:01
 testcase [^] (627 bytes) 07-20-05 08:21
 ash-local-fix2.diff [^] (1,708 bytes) 07-20-05 09:55

- Relationships

- Notes
(0000197)
robtaylor
04-28-05 06:04

ash-local-fix.diff seems to fix the issue for me. I'm not sure of its correctness however.
 
(0000311)
srowe
07-20-05 00:57

Nice try Rob but I've had ash SEGV since using this patch so I've had to back it out.

This bug is really biting us, I use the construct

    local oldifs=$IFS

all over my code and it no longer works properly in ash 1.0, see attached script and output.
 
(0000312)
robtaylor
07-20-05 08:24

ok. i now have a repro for the segv which occurs with my original patch.
to reproduce,

ash testcase 0/1/2/0123456/0123456789012/012345678901

it appears some sort of memory allocation bug is being hit, as (for example) removing a single character from the echo, or a single line from the case causes the bug to go away on my system. Of course, given this, it's quite possible this reproduction will only work on i686 machines similar to mine...
 
(0000314)
robtaylor
07-20-05 09:58

Ah, electric-fence is my new best friend. Attached patch ash-local-fix2.diff fixes the issue and doesnt display any allocation errors.
 
(0000317)
pgf
07-20-05 11:23

Committed revision 10875.
 

- Issue History
Date Modified Username Field Change
03-14-05 04:12 srowe New Issue
03-14-05 04:12 srowe File Added: test.sh
03-16-05 12:27 andersen Assigned To andersen => BusyBox
04-28-05 06:03 robtaylor File Added: ash-local-fix.diff
04-28-05 06:04 robtaylor Note Added: 0000197
07-20-05 00:57 srowe Note Added: 0000311
07-20-05 00:58 srowe File Added: ifs.sh
07-20-05 01:01 srowe File Added: ifs.out
07-20-05 08:21 robtaylor File Added: testcase
07-20-05 08:24 robtaylor Note Added: 0000312
07-20-05 09:55 robtaylor File Added: ash-local-fix2.diff
07-20-05 09:58 robtaylor Note Added: 0000314
07-20-05 11:23 pgf Status assigned => resolved
07-20-05 11:23 pgf Resolution open => fixed
07-20-05 11:23 pgf Note Added: 0000317
07-31-05 15:34 vapier Status resolved => closed


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker