Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Fix crash on unset-through-nameref



2024-03-04 19:34:09 +0000, Stephane Chazelas:
> 2024-03-04 00:39:30 -0800, Bart Schaefer:
> > On Sun, Mar 3, 2024 at 10:29 PM Stephane Chazelas <stephane@xxxxxxxxxxxx> wrote:
> > >
> > > That shows an unset through a nameref in a different scope
> > > doesn't do a full unset
> > 
> > Try removing this line from the patch:
> > 
> > +    pm->node.flags |= PM_DECLARED;
> > 
> > If that works, it'll also require updating the test.
> 
> That helps a bit but:
> 
> $ ./Src/zsh -c 'myunset() { typeset -n v=$1; unset v; }; export x=1; myunset x; typeset -p x; x=2; typeset -p x'
> export x=2
> 
> It still retained its export attribute.
[...]

The other one is now wrong in a different way:

$ ./Src/zsh -c 'f() { typeset -n v=$1; unset v; typeset -p w; v=(a b); }; w=1; f w; typeset -p w'
typeset -a w=( a b )
$ ./Src/zsh -c 'f() { typeset -n v=$1; unset v; typeset -p w; v=(a b); }; v=1; w=1; f w; typeset -p w'
$

-- 
Stephane




Messages sorted by: Reverse Date, Date, Thread, Author