On 27/02/2024 02:07, Christoph Anton Mitterer wrote:
Hey.
Forwarding this from my report (for the records) at:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1064874
POSIX describes[0] unset to:
unset values and attributes of variables and functions
While the exact detials are perhaps a bit unclear (see the discussion
at [1], I
think it is rather clear that unset, on a variable that has no readonly
attribute,
shall case the variable/value binding AND any attributes to be unset.
There is even a related bug where it causes attributes to be *added*:
under 'set -a', unset causes variables to be exported even if they
previously weren't.
set -a; unset foo; export
This is clearly wrong.
However, trying to fix this I come across a corner case where it is not
clear to me what the intended behaviour is.
set -a; readonly foo=bar; export # some shells export, not all
Cheers,
Harald van Dijk