summaryrefslogtreecommitdiffstats
path: root/Src
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2025-10-26 19:42:56 -0700
committerBart Schaefer <schaefer@zsh.org>2025-10-26 19:42:56 -0700
commit005ef2c8307ea032341d6e493c004a02a6f1e785 (patch)
treed8583eb3d984c3d4de45c93cfa526eb632a88b49 /Src
parent53798: report reference loops created when a reference goes out of scope (diff)
downloadzsh-005ef2c8307ea032341d6e493c004a02a6f1e785.tar
zsh-005ef2c8307ea032341d6e493c004a02a6f1e785.tar.gz
zsh-005ef2c8307ea032341d6e493c004a02a6f1e785.tar.bz2
zsh-005ef2c8307ea032341d6e493c004a02a6f1e785.tar.lz
zsh-005ef2c8307ea032341d6e493c004a02a6f1e785.tar.xz
zsh-005ef2c8307ea032341d6e493c004a02a6f1e785.tar.zst
zsh-005ef2c8307ea032341d6e493c004a02a6f1e785.zip
53676+54009: Revise 52650+51945 for assignment to global through nameref
Allows assignment to a global via nameref to succeed without creating a dereference loop. Update tests for changed behavior.
Diffstat (limited to 'Src')
-rw-r--r--Src/params.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/Src/params.c b/Src/params.c
index aa948cf0c..df6a917b2 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -1044,13 +1044,12 @@ createparam(char *name, int flags)
if (oldpm && !(flags & PM_NAMEREF) &&
(oldpm->level == locallevel ?
!(oldpm->node.flags & PM_RO_BY_DESIGN) : !(flags & PM_LOCAL)) &&
- (oldpm->node.flags & PM_NAMEREF) &&
- (oldpm = upscope(oldpm, oldpm->base))) {
+ (oldpm->node.flags & PM_NAMEREF)) {
Param lastpm;
struct asgment stop;
stop.flags = PM_NAMEREF;
- stop.name = oldpm->node.nam;
- stop.value.scalar = GETREFNAME(oldpm);
+ stop.name = "";
+ stop.value.scalar = NULL;
lastpm = (Param)resolve_nameref(oldpm, &stop);
if (lastpm) {
if (lastpm->node.flags & PM_NAMEREF) {