bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cannot shadow local -r when assigning local to array in declaration


From: Chet Ramey
Subject: Re: Cannot shadow local -r when assigning local to array in declaration
Date: Mon, 27 Apr 2020 16:36:19 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 4/23/20 8:02 PM, Ross Goldberg wrote:

> Bash Version: 5.0
> Patch Level: 16
> Release Status: release
> 
> Description:
> If a function, f, declares a local readonly variable, v, using local -r, an
> error occurs if f calls another function, g, that declares its own local
> variable v (therefore shadowing v from f) and that assigns v to an array in
> the same statement as the shadowing declaration.
> 
> g can, however, assign v to a scalar in a shadowing declaration.
> 
> g can also assign a shadowing v to an array, as long as it isn't assigned
> in the same statement as the declaration.

Thanks for the report. There will be a fix for this in the next devel
branch push.

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]