From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gatech.edu (gatech.edu [130.207.244.244]) by werple.mira.net.au (8.6.12/8.6.9) with SMTP id XAA24537 for ; Wed, 28 Jun 1995 23:40:01 +1000 Received: from math (math.skiles.gatech.edu) by gatech.edu with SMTP id AA00189 (5.65c/Gatech-10.0-IDA for ); Wed, 28 Jun 1995 09:35:38 -0400 Received: by math (5.x/SMI-SVR4) id AA00245; Wed, 28 Jun 1995 09:32:26 -0400 Resent-Date: Wed, 28 Jun 95 14:32:27 +0100 Old-Return-Path: Message-Id: <7937.9506281332@pyro.swan.ac.uk> To: zsh-workers@math.gatech.edu (Zsh hackers list) Subject: signal trapping bug Date: Wed, 28 Jun 95 14:32:27 +0100 From: P.Stephenson@swansea.ac.uk X-Mts: smtp Resent-Message-Id: <"OIpys2.0.l3.fdLyl"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/119 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu Run the following function and type ^C during the sleep. fn () { trap 'trap - EXIT INT' EXIT INT ; sleep 5 ; } % fn ^C zsh: 7433 abort (core dumped) ./zsh (You may require my recent signal fixes to see this. They are not the cause of the problem.) I believe what's happening is that the function call code is saving the old exit function and restoring it, even though the pointer is now invalid because the same function was deleted by the copy in sigfuncs[SIGEXIT]. As the function only gets used at that point if it's changed, it makes more sense to set the trap to zero for the duration of the function anyway. This fixes things. *** Src/exec.c.xfn Tue Jun 27 15:57:36 1995 --- Src/exec.c Wed Jun 28 13:58:23 1995 *************** *** 2277,2282 **** --- 2277,2284 ---- pushheap(); xexittr = sigtrapped[SIGEXIT]; xexitfn = sigfuncs[SIGEXIT]; + sigtrapped[SIGEXIT] = 0; + sigfuncs[SIGEXIT] = 0; tab = pparams; oargv0 = argzero; oldzoptind = zoptind; *************** *** 2337,2343 **** opts[PRINTEXITVALUE] = saveopts[PRINTEXITVALUE]; opts[LOCALOPTIONS] = saveopts[LOCALOPTIONS]; } ! if (sigfuncs[SIGEXIT] && sigfuncs[SIGEXIT] != xexitfn) { dotrap(SIGEXIT); freestruct(sigfuncs[SIGEXIT]); } --- 2339,2345 ---- opts[PRINTEXITVALUE] = saveopts[PRINTEXITVALUE]; opts[LOCALOPTIONS] = saveopts[LOCALOPTIONS]; } ! if (sigfuncs[SIGEXIT]) { dotrap(SIGEXIT); freestruct(sigfuncs[SIGEXIT]); } -- Peter Stephenson Tel: +44 1792 205678 extn. 4461 WWW: http://python.swan.ac.uk/~pypeters/ Fax: +44 1792 295324 Department of Physics, University of Wales, Swansea, Singleton Park, Swansea, SA2 8PP, U.K.