patchThe GNU Bourne-Again SHell - Patches: patch #7818, Loop breaks when trying to write...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #7818: Loop breaks when trying to write to a readonly variable

Submitter:  Daniel Amthor <danam21>
Submitted:  Fri 13 Jul 2012 12:53:04 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Wont Do Privacy:  Public
Assigned to:  None Open/Closed:  Open

Fri 13 Jul 2012 12:53:04 PM UTC, original submission:  

In a construct like this:

var=foo
readonly var
for num in 1 2 3 4 5
do
if [ $num -eq 3 ]
then
var=bar
fi 
echo $num
done

the loop breaks in the third round, after trying to set the r/o variable. Particularly an issue, when looping the the scripts in profile.d, should a variable be set twice by accident or if the scripts are sourced again by a script.

Latest version accessible:
~/test > bash --version
GNU bash, version 4.2.24(1)-release (x86_64-pc-linux-gnu)
on Ubuntu Precise.

Daniel Amthor <danam21>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chet (Updated the item)
  • -email is unavailable- added by danam21 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-05-04 chet StatusNone Wont Do

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code