Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Crash when exporting scalar without value and getsparam fails



On Sat, Jan 10, 2015 at 9:04 PM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Jan 10,  8:10pm, Mikael Magnusson wrote:
> }
> } % unset IFS
> } % export IFS
> } % IFS=5
> } % unset IFS
> } % printenv|grep IFS # this would be empty for a normal parameter
> } IFS=5
>
> OK, so the remaining issue is that the PM_EXPORT flag is not cleared
> when a special parameter is unset.
>
> I think this is within the definition of how a special paramter behaves;
> i.e., it retains all its attributes even when unset.  In this case we
> have an attribute that's not normally "part of the specialness" of the
> parameter, which is also being preserved.  The same thing happens with
> other flags on other specials, e.g.:
>
> torch% print $SECONDS
> 762
> torch% typeset -E SECONDS
> torch% print $SECONDS
> 7.801753190e+02
> torch% unset SECONDS
> torch% print $SECONDS
>
> torch% SECONDS=763
> torch% print $SECONDS
> 7.671235090e+02
>
>
> So should e.g. stdunsetfn() and tiedarrunsetfn() clear the PM_EXPORTED
> flag as well as assert the PM_UNSET flag?  Or is that going to cause a
> problem elsewhere because there is a special parameter that has the
> feature of always being exported?  I can't think of any, but maybe we
> shouldn't rule it out ... in which case this gets really hairy, as we
> will have to know, for every special, what flags should or should not
> be retained across unset.

Ah, these are good points. I don't have any especially strong feelings
about making IFS stop being exported after unset, I was just reporting
what I observed in case it indicated some further wonkiness.

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author