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


Groups > gnu.bash.bug > #14899

assignment to a nameref that resolves to the temporary environment

From Grisha Levit <grishalevit@gmail.com>
Newsgroups gnu.bash.bug
Subject assignment to a nameref that resolves to the temporary environment
Date 2018-12-09 01:28 -0500
Message-ID <mailman.5421.1544336916.1284.bug-bash@gnu.org> (permalink)

Show all headers | View raw


When a nameref local to a higher function scope points to a variable in the
temporary environment, that nameref (correctly, it seems) expands to the
value
of the target variable from the temporary environment. However, assignment
to
the nameref modifies the variable from the higher scope, bypassing the
tempenv:

    $ a() { local -n ref=var; var=tmp b; echo $ref; }
    $ b() { ref=$ref; }
    $ var=foo; a
    tmp

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


Thread

assignment to a nameref that resolves to the temporary environment Grisha Levit <grishalevit@gmail.com> - 2018-12-09 01:28 -0500

csiph-web