[BusyBox-cvs] [BusyBox 0000152]: ash: quoting rules for local variables different to globals

bugs at busybox.net bugs at busybox.net
Wed Jul 20 15:24:55 UTC 2005


A NOTE has been added to this issue. 
====================================================================== 
http://busybox.net/bugs/view.php?id=152 
====================================================================== 
Reported By:                srowe
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   152
Category:                   Other
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             03-14-2005 04:12 PST
Last Modified:              07-20-2005 08:24 PDT
====================================================================== 
Summary:                    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


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

---------------------------------------------------------------------- 
 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. 

---------------------------------------------------------------------- 
 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. 

---------------------------------------------------------------------- 
 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... 

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                          
======================================================================




More information about the busybox-cvs mailing list