1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-28 05:00:59 +01:00

48560: add TYPESET_TO_UNSET option to remove initialization of parameters

Changes typeset such that ${newparam-notset} yields "notset" and
"typeset -p newparam" does not show an assignment to the parameter.  This
is similar to the default behavior of bash and ksh, with minor differences
in typeset output.

Also add tests for some POSIX incompatibilities plus minor changes for test
harness robustness.
This commit is contained in:
Bart Schaefer 2021-04-18 13:58:09 -07:00
parent 56ccb4a975
commit 82ff9f24f1
15 changed files with 102 additions and 18 deletions

View file

@ -2563,7 +2563,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
* Handle the (t) flag: value now becomes the type
* information for the parameter.
*/
if (v && v->pm && !(v->pm->node.flags & PM_UNSET)) {
if (v && v->pm && ((v->pm->node.flags & PM_DECLARED) ||
!(v->pm->node.flags & PM_UNSET))) {
int f = v->pm->node.flags;
switch (PM_TYPE(f)) {