The 20160506 snapshot changes assign_in_env to do some nameref-related
checks on the variable name, but these don’t really seem to make sense
since assignments in the temporary env just create regular variables and
don’t follow the nameref chain otherwise.

i.e. bash doesn’t actually care that ref is a nameref at the outer scope
for the purposes of creating the temp env:

$ unset var; declare -n ref=var
$ ref=xxx declare -p ref var       # the chain is not followed for
assignment (makes sense)
declare -x ref="xxx"
bash: declare: var: not found

$ var= ref=5 declare -p ref
declare -x ref="5"

$ ref=5 declare -p ref
bash: `5': not a valid identifier   # this shouldn't matter?
declare -n ref="var"

Same thing for the check to see if ref points to a readonly variable.
​

Reply via email to