From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6588 invoked from network); 28 Oct 1999 08:59:43 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 28 Oct 1999 08:59:43 -0000 Received: (qmail 27348 invoked by alias); 28 Oct 1999 08:59:38 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8473 Received: (qmail 27341 invoked from network); 28 Oct 1999 08:59:37 -0000 Date: Thu, 28 Oct 1999 10:59:36 +0200 (MET DST) Message-Id: <199910280859.KAA19136@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Clint Adams's message of Wed, 27 Oct 1999 16:08:15 -0400 Subject: Re: unhappy signals Clint Adams wrote: > % TRAPEXIT() { print boom } > % exit > boom > zsh: 8101 segmentation fault (core dumped) zsh -f > > > Reversing the removehashnode hunk in 7349 fixes this, > but of course the TRAPQUIT example now segfaults. > > What to do? The problem occurred as soon as a functions was called... The problem was that `dosavetrap()' when called from `starttrapscope()' removed the definition for `TRAPEXIT()' but didn't reset the entry for it in `sigtrapped[]'. In `endtrapscope()' we tested `sigtrapped[SIGEXIT]' which was still `!= 0' even though we had removed the handler function. Then we tried to get the function definition, got a NULL pointer and later tried to execute that. Bang. This patch resets the `sigtrapped[]' entry in `dosavetrap()'. I'm not sure if this is enough, maybe we have to execute some code from `unsettrap()' there, too. So I think the final solution has to wait until Peter reappears. Bye Sven diff -u oldsrc/signals.c Src/signals.c --- oldsrc/signals.c Thu Oct 28 10:12:49 1999 +++ Src/signals.c Thu Oct 28 10:52:57 1999 @@ -668,6 +668,7 @@ st->list = sigfuncs[sig]; unsettrap(sig); } + sigtrapped[sig] = 0; notrapfree--; PERMALLOC { if (!savetraps) @@ -829,6 +830,7 @@ if (sigtrapped[sig]) unsettrap(sig); + sigtrapped[sig] = st->flags; if (st->flags) { List list = (st->flags & ZSIG_FUNC) ? ((Shfunc) st->list)->funcdef : (List) st->list; -- Sven Wischnowsky wischnow@informatik.hu-berlin.de