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


Groups > gnu.bash.bug > #14904

Re: issues with nameref resolution loop in a function

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: issues with nameref resolution loop in a function
Date 2018-12-11 14:36 -0500
Organization ITS, Case Western Reserve University
Message-ID <mailman.5598.1544557033.1284.bug-bash@gnu.org> (permalink)
References <CAMu=BroWK=ykh8u8bi0mRvvDPwjp2y1Y7wNx179dM1Tqn1Koqg@mail.gmail.com>

Show all headers | View raw


On 12/8/18 8:30 PM, Grisha Levit wrote:
> There seems to be an issue with the following new bash-5.0 feature:
> 
>   A nameref name resolution loop in a function now resolves to a variable by
>   that name in the global scope.
> 
> [ Note: "warning: x: circular name reference" messages omitted below. ]
> 
> While referencing such a nameref works as described, scalar assignment to it
> modifies the variable from the next higher scope rather than the global one:

Yes, that's what it does right now. The resolution change is the only one I
made, and I'm still not convinced it's the right thing. The code that does
the assignment is unchanged, with a comment that says backwards
compatibility.

That code can operate on the global instance, ignore the nameref attribute
and change the value, or just ignore the variable as if it didn't exist.
Right now it does what it did in bash-4.4.

(Cue Greg and his "nameref variables are an unworkable botch and should
just be ignored.")

-- 
``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 | Unroll thread


Thread

Re: issues with nameref resolution loop in a function Chet Ramey <chet.ramey@case.edu> - 2018-12-11 14:36 -0500

csiph-web