summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2024-03-02 21:37:25 -0800
committerBart Schaefer <schaefer@zsh.org>2024-03-02 21:37:25 -0800
commitd1ff06f99185bb14554c6a48e0466aee6466ecac (patch)
tree47f82ab06239b49b2208854e6a1bdb007c3726f0
parent145397b6dc6fc2cbb5fc529e36fb540b9fc7ec59 (diff)
downloadzsh-d1ff06f99185bb14554c6a48e0466aee6466ecac.tar.gz
zsh-d1ff06f99185bb14554c6a48e0466aee6466ecac.zip
52652: fix obscure bug unsetting the array part of a tied parameter pair
-rw-r--r--ChangeLog3
-rw-r--r--Src/params.c7
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7273034ac..9718d0cae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2024-03-02 Bart Schaefer <schaefer@zsh.org>
+ * 52652: Src/params.c, Test/D04parameter.ztst: fix obscure bug
+ unsetting the array part of a tied parameter pair, update test
+
* JunT.: 52635: Test/runtests.zsh: show file name when crashed
* 52612: Src/parse.c, Src/subst.c, Src/utils.c: change the %l
diff --git a/Src/params.c b/Src/params.c
index 064dbd2bc..e83e4aa5e 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -3813,12 +3813,15 @@ unsetparam_pm(Param pm, int altflag, int exp)
/* fudge things so removenode isn't called */
altpm->level = 1;
}
- unsetparam_pm(altpm, 1, exp);
+ unsetparam_pm(altpm, 1, exp); /* This resets pm to empty */
+ pm->node.flags |= PM_UNSET; /* so we must repeat this */
}
zsfree(altremove);
- if (!(pm->node.flags & PM_SPECIAL))
+ if (!(pm->node.flags & PM_SPECIAL)) {
pm->gsu.s = &stdscalar_gsu;
+ pm->node.flags &= ~PM_ARRAY;
+ }
}
/*