summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Altherr <philippe.altherr@gmail.com>2026-04-11 00:59:53 +0200
committerdana <dana@dana.is>2026-06-03 23:26:38 -0500
commit9ca111beeea8e9dbdd3d73f49aae15b3645a65f9 (patch)
tree784c879e51d95c561190e28f4356a7a08ff04149
parentunposted: tests: add regression test for w/54340 (diff)
downloadzsh-9ca111beeea8e9dbdd3d73f49aae15b3645a65f9.tar
zsh-9ca111beeea8e9dbdd3d73f49aae15b3645a65f9.tar.gz
zsh-9ca111beeea8e9dbdd3d73f49aae15b3645a65f9.tar.bz2
zsh-9ca111beeea8e9dbdd3d73f49aae15b3645a65f9.tar.lz
zsh-9ca111beeea8e9dbdd3d73f49aae15b3645a65f9.tar.xz
zsh-9ca111beeea8e9dbdd3d73f49aae15b3645a65f9.tar.zst
zsh-9ca111beeea8e9dbdd3d73f49aae15b3645a65f9.zip
54328: Only ever turn global parameters into named directories
see also 54299, 54309, 54340
-rw-r--r--ChangeLog4
-rw-r--r--Doc/Zsh/options.yo2
-rw-r--r--Src/params.c7
-rw-r--r--Src/utils.c2
4 files changed, 7 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 8194ce98a..f998efaa2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2026-06-04 dana <dana@dana.is>
+ * Philippe Altherr: 54328: Doc/Zsh/options.yo, Src/params.c,
+ Src/utils.c: Only ever turn global parameters into named
+ directories
+
* unposted: Test/A06assign.ztst: add regression test for w/54340
* Philippe Altherr: 54340: Src/params.c: Remove partial
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 3e745ec3d..3e3d9392a 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -240,7 +240,7 @@ pindex(AUTONAMEDIRS)
pindex(NOAUTONAMEDIRS)
cindex(directories, named)
item(tt(AUTO_NAME_DIRS))(
-Any parameter that is set to the absolute name of a directory
+Any global parameter that is set to the absolute name of a directory
immediately becomes a name for that directory, that will be used
by the `tt(%~)'
and related prompt sequences, and will be available when completion
diff --git a/Src/params.c b/Src/params.c
index 191556fe8..1620b2a11 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -3910,11 +3910,6 @@ unsetparam_pm(Param pm, int altflag, int exp)
if (pm->old) {
oldpm = pm->old;
paramtab->addnode(paramtab, oldpm->node.nam, oldpm);
- if ((PM_TYPE(oldpm->node.flags) == PM_SCALAR) &&
- !(pm->node.flags & PM_HASHELEM) &&
- (oldpm->node.flags & PM_NAMEDDIR) &&
- oldpm->gsu.s == &stdscalar_gsu)
- adduserdir(oldpm->node.nam, oldpm->u.str, 0, 0);
if (oldpm->node.flags & PM_EXPORTED) {
/*
* Re-export the old value which we removed in typeset_single().
@@ -4033,7 +4028,7 @@ strsetfn(Param pm, char *x)
if (pm->u.str) zsfree(pm->u.str);
pm->u.str = x;
}
- if (!(pm->node.flags & PM_HASHELEM) &&
+ if (!(pm->node.flags & PM_HASHELEM) && !pm->level &&
((pm->node.flags & PM_NAMEDDIR) || isset(AUTONAMEDIRS))) {
pm->node.flags |= PM_NAMEDDIR;
adduserdir(pm->node.nam, x, 0, 0);
diff --git a/Src/utils.c b/Src/utils.c
index 3d387f967..e16a9085e 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1258,7 +1258,7 @@ getnameddir(char *name)
/* Check if there is a scalar parameter with this name whose value *
* begins with a `/'. If there is, add it to the hash table and *
* return the new value. */
- if ((pm = (Param) paramtab->getnode(paramtab, name)) &&
+ if ((pm = (Param) paramtab->getnode(paramtab, name)) && !pm->level &&
(PM_TYPE(pm->node.flags) == PM_SCALAR) &&
(str = getsparam(name)) && *str == '/') {
pm->node.flags |= PM_NAMEDDIR;