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

Submitted by:  Daniel Amthor <danam21>
Submitted on:  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>

 

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)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

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