* Ouch! unset '*'
@ 1999-02-06 21:18 Bart Schaefer
0 siblings, 0 replies; only message in thread
From: Bart Schaefer @ 1999-02-06 21:18 UTC (permalink / raw)
To: zsh-workers
In the course of playing around with the (lack of) local-ness of $argv, I
happened upon this bit of behavior:
----------
zsh% function ouch() { unset '*' }
zsh% set a b c
zsh% echo $*
a b c
zsh% ouch
zsh% echo $*
zsh% echo $@
a b c
----------
Once you get into this state, there's NO WAY to get $* to exist again, in
any scope. At least with argv you can do `argv=($@)` to get it to exist
again (and to track $* properly too). Similarly, `unset @` will kill $@
in all scopes for the duration of the current shell and its subshells.
Subsequent to `unset @` or `unset '*'` you can use `set ...` to get the
positional parameters back (so $1 $2 etc. work again), but this does not
restore any of $argv, $*, or $@ that have been individually unset.
This seems to me to be a pretty bad situation. Worse, `unset -m '*'`
actually crashes 3.1.5-pws-7, though it does not crash 3.0.5. It appears
that
zsh% unset PWD OLDPWD
is a minimum command necessary to cause this crash, though there may be
other combinations of variables that crash the shell when simultaneously
unset. I haven't had a chance to investigate further, but `unset -m '*'`
ought to work.
Back on the original question, it seems to me that it shouldn't be possible
to unset '*' and '@', only to make them empty. Is it sufficient to mark
them read-only, or will that prevent assigning to argv?
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-02-06 21:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-06 21:18 Ouch! unset '*' Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).