summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-01-10 10:27:01 -0800
committerBarton E. Schaefer <schaefer@zsh.org>2015-01-10 10:32:31 -0800
commitdaa788d88b7935ac93a9be54691bdd56e68ae2f3 (patch)
treec37995135e0946f0c002ffa39cf1328d22f162e7
parent199581f7803795a521be0d37c462fd7c3a6506a1 (diff)
downloadzsh-daa788d88b7935ac93a9be54691bdd56e68ae2f3.tar.gz
zsh-daa788d88b7935ac93a9be54691bdd56e68ae2f3.zip
34212: do not change unset-ness of special parameters when exporting them
-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;