Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: unhappy signals
- X-seq: zsh-workers 8473
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: unhappy signals
- Date: Thu, 28 Oct 1999 10:59:36 +0200 (MET DST)
- In-reply-to: Clint Adams's message of Wed, 27 Oct 1999 16:08:15 -0400
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author