R-beta: ctrl-c

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Thu May 14 12:13:23 CEST 1998

Jim Lindsey <jlindsey at luc.ac.be> writes:

> There is something I do not understand about ctrl-c not working in R
> 0.61.x with Red Hat 5. I use GLIM compiled with f2c and ctrl-c does
> work as it should.  This seems to imply that there is a problem with
> the way that it is implemented in R or at least that it could be
> implemented to work in R with Red Hat 5.
>   Jim

Yes. I think that we have now "found the enemy and it is us." R
returns from signal handlers using longjmp() which is asking for
trouble because it may leave signals blocked. So things may have
changed in glibc() but it is "legal" for it to do so. How to fix the
problem correctly is another matter, but according to Luke Tierney
there's a workaround by explicitly setting the signal mask on return
from the signal handler. Here's the relevant excerpt of his note:

``There seem to be two possible solutions. The quick-and-dirty one is to
add the following after the

        signal(SIGINT, onintr);

calls in main.c:

    sigset_t set;
    sigaddset(&set, SIGINT);
    sigprocmask(SIG_UNBLOCK, &set, NULL);

This unblocks the signal again. This should probably be wrapped in...''

We didn't get this cleared up for 0.61.3 (it may work on some systems
only etc., etc.), but I certainly hope that we get it done in 0.62
(due out June 14). Meanwhile, you could try to patch the sources in
the indicated manner.

   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list