Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14415
| From | Grisha Levit <grishalevit@gmail.com> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Re: delcare -a on a nameref in a function modifies nameref instead of target |
| Date | 2018-07-29 16:04 -0400 |
| Message-ID | <mailman.4394.1532894682.1292.bug-bash@gnu.org> (permalink) |
| References | <CAMu=BrqTimtENjRABPgRdDhn5bQG2zBMv5YfQsNQDETh6oAjeQ@mail.gmail.com> <CAMu=Brq3CfiUWmauM8n=MYHeaWSywE5_sEJzBd0ET3SrrB+1KA@mail.gmail.com> <ae9ccdae-89e3-388b-d6e5-e1ce6cd914dd@case.edu> |
I think there's a related regression in the latest devel commit. Creating a
local variable with the same name as a higher-scoped nameref pointing to an
unset variable creates a local variable with the name of the target of the
nameref.
Starting with:
declare -n ref=var
f() { local ref=Y; declare -p ref var; local; }
This still works fine in both latest and previous:
$ var=X; f
declare -- ref="Y"
declare -- var="X"
ref=Y
But the behavior in the unset target case changed from the expected:
$ unset var; f
declare -- ref="Y"
bash: declare: var: not found
ref=Y
to:
$ unset var; f
declare -n ref="var"
declare -- var="Y"
var=Y
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: delcare -a on a nameref in a function modifies nameref instead of target Grisha Levit <grishalevit@gmail.com> - 2018-07-29 16:04 -0400
csiph-web