From daa788d88b7935ac93a9be54691bdd56e68ae2f3 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Sat, 10 Jan 2015 10:27:01 -0800 Subject: 34212: do not change unset-ness of special parameters when exporting them --- Src/builtin.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Src') diff --git a/Src/builtin.c b/Src/builtin.c index 8abe728db..8dee8f910 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -1935,7 +1935,7 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func), * even if that's unset */ if (pm && (pm->node.flags & PM_SPECIAL)) - usepm = 1; + usepm = 2; /* indicate that we preserve the PM_UNSET flag */ /* * Don't use an existing param if @@ -2072,7 +2072,11 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func), arrfixenv(pm->node.nam, x); } } - pm->node.flags = (pm->node.flags | (on & ~PM_READONLY)) & ~(off | PM_UNSET); + if (usepm == 2) /* do not change the PM_UNSET flag */ + pm->node.flags = (pm->node.flags | (on & ~PM_READONLY)) & ~off; + else + pm->node.flags = (pm->node.flags | + (on & ~PM_READONLY)) & ~(off | PM_UNSET); if (on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z)) { if (typeset_setwidth(cname, pm, ops, on, 0)) return NULL; -- cgit 1.4.1