Re: [PATCH] Don't segfault when uniquifying hidden tied arrays

Bart Schaefer <[email protected]> Tue, 21 Jul 2026 13:54:46 -0700
Newsgroups gmane.comp.shells.zsh.devel
Message-ID <CAH+w=7Z_Y7-5PDZTzssVVyBBtX1X4XQSFr6TLS3EWSkcs+DbWw@mail.gmail.com>
On Mon, Jul 20, 2026 at 6:16=E2=80=AFAM Philippe Altherr
<[email protected]> wrote:
>
> While pm->u.data is never NULL, the value assigned to x may be NULL but t=
hat's fine, then the code that follows simply does nothing; the function un=
iqarray immediately returns if its parameter is NULL.

The test case that fails if &nullarray is NOT returned by gsu.a->getfn is
  Running test: add array to empty parameter

With your patch:

Src/zsh -f
% setopt typesettounset
% typeset -T VAR var
% () { typeset -i var; typeset -g -U VAR }
% echo $VAR

% echo $+VAR
0
% () { typeset -i var; typeset -g -U VAR=3D'a:a:b' }
% () { typeset -i var; typeset -g -U VAR=3D'a:a:b'; typeset -p VAR }
zsh: bus error  Src/zsh -f

It crashes on "typeset -p" rather than on the assignment itself.
Without your patch, the above does not crash (but your original
example does).