[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Signals under Solaris (es 0.9alpha1)



I just discovered that es 0.9alpha1, on Solaris, blocks SIGINT.  That is,
not right away, but all it takes is to start a virgin es (not a login
shell, and only a minimal environment) and execute

signals=$signals

and then signal 2 (SIGINT) is blocked (in the sense of being marked in the
process' signal mask).  Some further experimentation indicates that the
problem occurs whenever $signals already contains .sigint and I set
signals to some list containing .sigint again.  As an experiment, I tried
setting

set-signals=@ {$&setsignals; $&setsignals $*}

and this cured the bug partly; but the problem just moved elsewhere.  If
es sees a SIGINT, it blocks SIGINT in the future.

Here's a quick demo.  The program sigprocmask just does the system call of
the same name and prints what it finds.  I run sleep 60, and interrupts
it. No problem, but SIGINT is now blocked.  If I run sleep 60 again and
hit ^C, nothing happens, and I must type ^\ or wait until the minute has
passed.

$ /bin/es
; ~/test/sigprocmask
sigprocmask={00000000,00000000,00000000,00000000}
; sleep 60
^C
; ~/test/sigprocmask
sigprocmask={00000002,00000000,00000000,00000000}
; sleep 60
^C^\quit--core dumped
; ~/test/sigprocmask
sigprocmask={00000002,00000000,00000000,00000000}

I tried turning on USE_SIGACTION in config.h, and that cured the first
version of the problem, but made the second version even a little worse:
 After the experiment above, SIGQUIT is also blocked.

So what do we try next?  I don't really understand signals all that well,
and have already wasted too much time messing around with this problem.
 From earlier discussions it has been my impression that sigaction is what
we want to use when it exists, but this blocking of signals is another
ball game alltogether.

- Harald

PS.  Source code for the sigprocmask test program:

#include <stdlib.h>
#include <stdio.h>
#include <signal.h>

void
main() {
  sigset_t oset;
  if (sigprocmask(SIG_UNBLOCK, NULL, &oset)) perror("sigprocmask");
  else printf("sigprocmask={%08x,%08x,%08x,%08x}\n",
	      oset.__sigbits[0],
	      oset.__sigbits[1],
	      oset.__sigbits[2],
	      oset.__sigbits[3]);
}