Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16250

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

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: Cannot shadow local -r when assigning local to array in declaration
Date 2020-04-27 16:36 -0400
Organization ITS, Case Western Reserve University
Message-ID <mailman.1427.1588019796.3066.bug-bash@gnu.org> (permalink)
References <CAAEcvMqof2+-vLwd_qrQYuVdcz497nr3hKdd5Kc0333Ygw5hVQ@mail.gmail.com> <4a9e99d5-fba4-bcdb-9368-36c6aba73e90@case.edu>

Show all headers | View raw


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/

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Re: Cannot shadow local -r when assigning local to array in declaration Chet Ramey <chet.ramey@case.edu> - 2020-04-27 16:36 -0400

csiph-web