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

bugs at busybox.net bugs at busybox.net
Sun Jul 31 22:34:51 UTC 2005


The following issue has been CLOSED 
====================================================================== 
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:                     closed
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             03-14-2005 04:12 PST
Last Modified:              07-31-2005 15:34 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... 

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

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




More information about the busybox-cvs mailing list