Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] Fix crash on unset-through-nameref
- X-seq: zsh-workers 52668
- From: Stephane Chazelas <stephane@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: [PATCH] Fix crash on unset-through-nameref
- Date: Mon, 4 Mar 2024 19:36:41 +0000
- Archived-at: <https://zsh.org/workers/52668>
- In-reply-to: <20240304193409.lv725ah6eifiazzx@chazelas.org>
- List-id: <zsh-workers.zsh.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- References: <CAH+w=7ayqWoufueuaHiCzjmzgHtv6VV0m7mEXoHn5nGq4pNOzg@mail.gmail.com> <20240304062914.kn6wquvgog3lefom@chazelas.org> <CAH+w=7b9dcQ4f=71rFZSWBVEJ4bzj7NxzD2-zoj2TkpaCkaCjw@mail.gmail.com> <20240304193409.lv725ah6eifiazzx@chazelas.org>
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