1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-01-01 17:24:50 +01:00

51573: additional "typset -p -m" fix for namespaces

The "-m pattern" option is supposed to enable printing namespaces, but
that didn't work when combined with -p.

The -p option could also cause an unset parameter to become set if a
named reference pointed at it.
This commit is contained in:
Bart Schaefer 2023-03-14 20:51:15 -07:00
parent dd13048b3b
commit 4b7a9fd0ec
2 changed files with 9 additions and 3 deletions

View file

@ -1,3 +1,7 @@
2023-03-14 Bart Schaefer <schaefer@zsh.org>
* 51573: Src/builtin.c: additional "typset -p -m" fix for namespaces
2023-03-13 Bart Schaefer <schaefer@zsh.org>
* 51572: Functions/Misc/run-help: fix error when running standalone

View file

@ -2236,12 +2236,12 @@ typeset_single(char *cname, char *pname, Param pm, int func,
}
on &= ~PM_LOCAL;
if (!on && !roff && !ASG_VALUEP(asg)) {
int with_ns = OPT_ISSET(ops,'m') ? PRINT_WITH_NAMESPACE : 0;
if (OPT_ISSET(ops,'p'))
paramtab->printnode(&pm->node, PRINT_TYPESET);
paramtab->printnode(&pm->node, PRINT_TYPESET|with_ns);
else if (!OPT_ISSET(ops,'g') &&
(unset(TYPESETSILENT) || OPT_ISSET(ops,'m')))
paramtab->printnode(&pm->node,
PRINT_INCLUDEVALUE|PRINT_WITH_NAMESPACE);
paramtab->printnode(&pm->node, PRINT_INCLUDEVALUE|with_ns);
return pm;
}
if ((pm->node.flags & PM_RESTRICTED) && isset(RESTRICTED)) {
@ -2502,6 +2502,8 @@ typeset_single(char *cname, char *pname, Param pm, int func,
"%s: inconsistent array element or slice assignment", pname);
return NULL;
}
} else if (!pm && OPT_ISSET(ops,'p')) {
return NULL;
}
/*
* As we can hide existing parameters, we allow a name if