Subject: Re: Trivial program spins on divide by zero
To: None <gavan@coolfactor.org>
From: Tim Goodwin <tjg@star.le.ac.uk>
List: current-users
Date: 08/14/2003 13:00:21
> int main(void) {
> for (;;) {
> sleep(1);
> }
> }
>
> and then send it a signal? Does it then start spinning?
No, but it doesn't respond to any signal except KILL (according to
ktrace, the process does not receive the signals).
It gets stranger: this *only* happens under X: programs running on the
console behave as expected (the integer-division-by-zero dumps core on
SIGFPE). It doesn't matter whether I run under xterm or
gnome2-terminal, and it's both keyboard-generated signals and explicit
`kill' commands from another window that disappear without trace.
<time passes>
OK, I'm making some progress in tracking this down. Signals only
disappear when i) I'm using GNOME, and ii) my shell is NOT csh.
(Normally I use rc, of course :-), but signals also disappear with
/bin/sh.)
It seems that something in GNOME (gnome-session? metacity?) is setting
a ridiculous signal mask. Since csh frobs with sigprocmask() itself,
it doesn't matter - provided your shell is csh. But when a Real Shell
inherites this crazy signal mask, you get the unhelpful behaviour I'm
seeing.
More if I get any further.
Tim.