Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!husc6!hao!oddjob!gargoyle!ihnp4!cbosgd!osu-cis!tut!karl From: karl@tut.cis.ohio-state.edu (Karl Kleinpaste) Newsgroups: comp.sources.bugs Subject: Re: another tcsh bug Message-ID: <24@tut.cis.ohio-state.edu> Date: Fri, 4-Sep-87 11:07:37 EDT Article-I.D.: tut.24 Posted: Fri Sep 4 11:07:37 1987 Date-Received: Sat, 5-Sep-87 21:59:19 EDT References: <16196@teknowledge-vaxc.ARPA> Organization: Ohio State University Computer and Information Science Dept Lines: 50 mkhaw@teknowledge-vaxc.ARPA writes: >I accidentally pressed ^C twice (SIGINT) at the tcsh prompt just a few >moments ago, and it spat out "Faulty alias 'periodic' removed." Normally, >I have "periodic" aliased to "checknews" and tperiod unset. After the >message, sure enough, "periodic" was no longer one of my aliases. > >This is repeatable on my system (Ultrix 1.2). If I set tperiod to a *nonzero* >value, this doesn't happen. It is quite repeatable with a nonzero $tperiod; you just have to catch it when the time period has passed the point where periodic has to be re-executed. If you happen to catch it at that point, the same thing will happen again. It should be reproducible in a manner like this: % alias periodic checknews [checknews executes once right away due to no $tperiod.] % set tperiod=1 [now checknews doesn't execute; 1 minute hasn't expired.] [so sit there for 61 seconds, and then:] % [checknews now re-executes since the $tperiod has expired.] ^C Faulty alias 'periodic' removed. % I put periodic/$tperiod in my version of csh several years ago; a lot of it has been absorbed by Paul into tcsh. The reason for the catch-and-remove-alias is to prevent the halt-and-catch-fire bug which it fixes; consider the following: % alias periodic 'bad double quote"' Given that execution of the periodic alias happens just before the printing of your prompt, right after executing this alias, the newly-created periodic alias will attempt to execute before printing another "%" prompt. But it will catch a quoting error in the process, resulting in a call to bferr() [builtin function error], which will toss the csh back to a point just before the printing of the prompt, where it will execute the periodic alias...ad infinitum. The catch code is there to annihilate a (supposedly) failing periodic alias. A side effect of this is that an interruption of a valid periodic alias will leave the flag set that the csh uses to determine a faulty periodic alias. Poof - your periodic alias is blown away. I haven't any good ideas for how to get around this problem. The code is sh.c; if you're feeling motivated, look it over and see if you can improve on it. [By the way, checknews is an *awfully* expensive periodic alias to be running before every single prompt (which is what happens when there is no $tperiod).] -- Karl