On 28 Apr 2016, at 02:36, Grisha Levit wrote:

> 
> On Wed, Apr 27, 2016 at 6:47 PM, Piotr Grzybowski <narsil...@gmail.com> wrote:
> +             if (v == 0 && onref || ( onref && !legal_identifier(value)))
> 
> Shouldn't this (and the other patch) check valid_array_reference as well to 
> support declare -n ref=a[x] ?

 yes most certainly should, and also should do a bit more.
 frankly, your original report:

readonly TMOUT=5; ref=$TMOUT; declare -n ref; ref=10; declare -n TMOUT; read

really scares me. The fix should also go to the nameref code, since I refuse to 
sanction the apparent entry in the variable table with name="5" and value="10" 
after this code is run, just by the fact that $TMOUT value is not a valid 
identifier.

cheers,
pg



Reply via email to