From mboxrd@z Thu Jan 1 00:00:00 1970 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes From: "Bart Schaefer" Message-Id: <990206131820.ZM30849@candle.brasslantern.com> Date: Sat, 6 Feb 1999 13:18:20 -0800 X-Mailer: Z-Mail (4.0b.820 20aug96) To: zsh-workers@sunsite.auc.dk Subject: Ouch! unset '*' MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailing-List: 5298 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