zsh-workers
 help / color / mirror / code / Atom feed
* unhappy signals
@ 1999-10-27 20:08 Clint Adams
  0 siblings, 0 replies; 2+ messages in thread
From: Clint Adams @ 1999-10-27 20:08 UTC (permalink / raw)
  To: zsh-workers

% 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?


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: unhappy signals
@ 1999-10-28  8:59 Sven Wischnowsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sven Wischnowsky @ 1999-10-28  8:59 UTC (permalink / raw)
  To: zsh-workers


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-10-28  8:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-27 20:08 unhappy signals Clint Adams
1999-10-28  8:59 Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).