On 27/02/2024 03:28, Christoph Anton Mitterer wrote:
On Tue, 2024-02-27 at 03:07 +0000, Harald van Dijk wrote:
I suspect the reason you don't see it happen with TERM, LINENO, and
HISTSIZE is because you have built dash in a configuration in which
these variables are not special.
Ah, I see... well I merely took the Debian unstable version of it.
For special variables, we get to
flags |= vp->flags & ~(VTEXTFIXED|VSTACK|VNOSAVE|VUNSET);
where we preserve the VEXPORT of the previous value. In case of
VUNSET,
we should not be doing that. I agree with your expectations, unset
should clear the export attribute.
So is it really just:
--- a/src/var.c 2024-02-27 04:25:32.000000000 +0100
+++ b/src/var.c 2024-02-27 04:22:40.744456151 +0100
@@ -295,7 +295,7 @@
goto out;
}
- flags |= vp->flags & ~(VTEXTFIXED|VSTACK|VNOSAVE|VUNSET);
+ flags |= vp->flags & ~(VEXPORT|VTEXTFIXED|VSTACK|VNOSAVE|VUNSET);
} else {
if (flags & VNOSET)
goto out;
I had even had that before, and it seemed to work, but wasn't really
sure whether it doesn't mess anything up behind the scenes which I
didn't understand.
This isn't right, this will unexport variables in other cases.
export FOO; FOO=bar; export
Cheers,
Harald van Dijk