summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c8
2 files changed, 11 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 10556e5e9..310f47110 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-10 Barton E. Schaefer <schaefer@zsh.org>
+
+ * 34212: Src/builtin.c: do not change unset-ness of special
+ parameters when exporting them
+
2015-01-09 Barton E. Schaefer <schaefer@zsh.org>
* 34202: Completion/Base/Widget/_complete_debug,
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;