1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-05-06 07:36:20 +02:00

unposted (cf. 52617): only scalars can instantiate a declared named reference

This commit is contained in:
Bart Schaefer 2024-03-04 21:36:45 -08:00
parent 83e9dd15c1
commit d27ea2ae02
2 changed files with 11 additions and 2 deletions

View File

@ -1,5 +1,8 @@
2024-03-04 Bart Schaefer <schaefer@zsh.org>
* unposted (cf. 52617): Src/params.c: only scalars can instantiate
a declared named reference
* 52659: Src/builtin.c, Test/K01nameref.ztst: Fix crash when unset
was called on a named referece, add regression test

View File

@ -1050,8 +1050,14 @@ createparam(char *name, int flags)
name = refname;
oldpm = NULL;
} else {
if (!(lastpm->node.flags & PM_READONLY))
lastpm->node.flags |= PM_UNSET;
if (!(lastpm->node.flags & PM_READONLY)) {
if (flags) {
/* Only plain scalar assignment allowed */
zerr("%s: can't change type of named reference",
name); /* Differs from ksh93u+ */
return NULL;
}
}
return lastpm;
}
} else {