Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!mandrill!hal!ncoast!allbery From: allbery@ncoast.UUCP Newsgroups: comp.sources.bugs Subject: Re: another tcsh bug Message-ID: <4481@ncoast.UUCP> Date: Sun, 6-Sep-87 22:57:11 EDT Article-I.D.: ncoast.4481 Posted: Sun Sep 6 22:57:11 1987 Date-Received: Tue, 8-Sep-87 01:21:08 EDT References: <16196@teknowledge-vaxc.ARPA> <24@tut.cis.ohio-state.edu> Reply-To: allbery@ncoast.UUCP (Brandon Allbery) Followup-To: comp.sources.bugs Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 43 As quoted from <24@tut.cis.ohio-state.edu> by karl@tut.cis.ohio-state.edu (Karl Kleinpaste): +--------------- | 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. | | 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. +--------------- It occurs to me that a better way to handle this is to set a flag "did the periodic alias" immediately before doing it, and clear it immediately after printing the prompt. If the flag is already set, don't execute the alias. Is there some valid reason (bad coding is _not_ a valid reason!) why this can't be done? (NB: I have neither SVR2 nor BSD source licenses, so I can't check it myself.) -- Brandon S. Allbery, moderator of comp.sources.misc {{harvard,mit-eddie}!necntc,well!hoptoad,sun!mandrill!hal}!ncoast!allbery ARPA: necntc!ncoast!allbery@harvard.harvard.edu Fido: 157/502 MCI: BALLBERY <> All opinions in this message are random characters produced when my cat jumped (-: up onto the keyboard of my PC. :-)