From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-request@euclid.skiles.gatech.edu Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.5/8.7.3) with ESMTP id KAA28290 for ; Mon, 4 Nov 1996 10:24:58 +1100 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id SAA11788; Sun, 3 Nov 1996 18:02:34 -0500 (EST) Resent-Date: Sun, 3 Nov 1996 18:02:34 -0500 (EST) From: Zoltan Hidvegi Message-Id: <199611032252.XAA01079@hzoli.ppp.cs.elte.hu> Subject: Re: setopt localfunctions, and two bugs with disable? To: schaefer@nbn.com Date: Sun, 3 Nov 1996 23:52:00 +0100 (MET) Cc: zsh-workers@math.gatech.edu In-Reply-To: <961103014452.ZM26121@candle.brasslantern.com> from Bart Schaefer at "Nov 3, 96 01:44:52 am" X-Mailer: ELM [version 2.4ME+ PL17 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"2rh1R1.0.5u2.9IIVo"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2321 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu > zagzig[440] functions > (... lots of output suppressed ...) > undefined work () { } > undefined xvi () { } > undefined zed () { } > undefined zfind () { } > undefined zlook () { } > undefined zm () { } > (... more output suppressed ...) > zagzig[441] disable -fm \* > zagzig[442] functions > undefined xvi () { } > zagzig[443] enable -fm \* > zagzig[444] functions > (... same output as history 440 ...) > zagzig[445] > > How did `xvi' survive through the "disable" command? Please try to investigate it further so that I could reproduce this bug. > Also, the shell in which I performed the above actions appears to have > silently exited (and without saving history) upon the next expiration of > TMOUT. I suspect that `disable -fm \*` did something bad with respect > to my TRAPALRM() function and the associated signal handlers, or at least > that `enable -fm \*` failed to restore something. You are right, disabling a TRAP functions really removes the function. The patch below is a fix for that. If a disable TRAPxxx function is enabled the currently set trap with the trap builtin is replaced by the function. The fix is not very elegant but it seems to work. Zoltan *** Src/hashtable.c 1996/11/02 22:47:53 3.1.0.2 --- Src/hashtable.c 1996/11/03 22:38:17 *************** *** 698,705 **** disableshfuncnode(HashNode hn, int flags) { hn->flags |= DISABLED; ! if (!strncmp(hn->nam, "TRAP", 4)) ! unsettrap(getsignum(hn->nam + 4)); } /* Re-enable an entry in the shell function hash table. * --- 698,709 ---- disableshfuncnode(HashNode hn, int flags) { hn->flags |= DISABLED; ! if (!strncmp(hn->nam, "TRAP", 4)) { ! int signum = getsignum(hn->nam + 4); ! sigtrapped[signum] &= ~ZSIG_FUNC; ! sigfuncs[signum] = NULL; ! unsettrap(signum); ! } } /* Re-enable an entry in the shell function hash table. *