Interrupt while raising an exception terminates the program with no error print

e$B1sF#$G$9!#e(B

raise e$B<B9TCf$Ke(B SIGINT e$B$G3d$j9~$s$@$H$-!"9b3NN($G2?$b8@$o$:$Ke(B
e$B0[>o=*N;$7$^$9!#e(B

$ ./ruby -ve ‘begin; raise; rescue; retry; end’
ruby 1.9.0 (2008-05-26 revision 16615) [i686-linux]
^C
$ echo $?
1

$ ./ruby -ve ‘while true; raise rescue nil; end’
ruby 1.9.0 (2008-05-26 revision 16615) [i686-linux]
^C
$ echo $?
1

e$B$3$l$O;EMM$G$7$g$&$+!#e(B
e$BJV$jCM$,e(B 1
e$B$K$J$C$F$k$+$i5$$E$1!"$H$$$&$3$H$+$b$7$l$^$;$s$,!"e(B
e$B5$$E$-$K$/$$$7860x$,$o$+$i$J$$$N$G4r$7$/$J$$$G$9!#e(B

e$B$3$N8=>]$Oe(B 2 e$B$D$NLdBj$+$i@.$k$h$&$G$9!#e(B

  • rb_longjmp e$B$,8F$P$l$F$+$ie(B JUMP_TAG e$B$9$k$^$G$K3d$j9~$_$,e(B
    e$BH/@8$7$?$H$-e(B [FATAL] exception reentered e$B$K$J$C$F$7$^$&e(B

  • [FATAL] exception reentered e$B$G%(%i!<$,I=<($5$l$J$$e(B

e$BA0<T$OIaDL$N%W%m%0%i%`$G$b$?$^$K5/$-$=$&$J$s$G$9$,!"$I$&BP=he(B
e$B$7$?$b$N$+$o$+$j$^$;$s!#3d$j9~$_=hM}$rCY1d$9$k%U%i%0$,I,MW!)e(B

e$B8e<T$OB?J,0J2<$G$J$s$H$+$J$k$H;W$$$^$9!#e(Berror_print e$B$ONc30$Ne(B
e$BH/@8$K5$$r;H$$$^$/$C$F$k$h$&$J$N$GBg>fIW$=$&$@$H;W$$$^$7$?$,!“e(B
[ruby-core:1122] e$B$N$h$&$KNc30$G:F5”$7$Fe(B SEGV e$B$9$k$h$&$JNc$,e(B
e$B$"$C$?$i$9$_$^$;$s!#e(B

$ ./ruby -ve ‘begin; raise; rescue; retry; end’
ruby 1.9.0 (2008-05-26 revision 16615) [i686-linux]
:17: exception reentered (fatal)

Index: eval_error.c

— eval_error.c (revision 16615)
+++ eval_error.c (working copy)
@@ -215,8 +215,6 @@
int status = EXIT_FAILURE;
rb_thread_t *th = GET_THREAD();

  • if (rb_thread_set_raised(th))
  • return EXIT_FAILURE;
    switch (ex & TAG_MASK) {
    case 0:
    status = EXIT_SUCCESS;
    @@ -247,8 +245,7 @@
    error_pos();
    warn_printf(": unexpected throw\n");
    break;
  •  case TAG_RAISE:
    
  •  case TAG_FATAL: {
    
  •  case TAG_RAISE: {
    
    VALUE errinfo = GET_THREAD()->errinfo;
    if (rb_obj_is_kind_of(errinfo, rb_eSystemExit)) {
    status = sysexit_status(errinfo);
    @@ -261,6 +258,9 @@
    }
    break;
    }
  •  case TAG_FATAL:
    
  •    error_print();
    
  • break;
    default:
    rb_bug(“Unknown longjmp status %d”, ex);
    break;

e$B$J$+$@$G$9!#e(B

At Mon, 26 May 2008 22:30:59 +0900,
Yusuke ENDOH wrote in [ruby-dev:34855]:

e$B$3$N8=>]$Oe(B 2 e$B$D$NLdBj$+$i@.$k$h$&$G$9!#e(B

  • rb_longjmp e$B$,8F$P$l$F$+$ie(B JUMP_TAG e$B$9$k$^$G$K3d$j9~$_$,e(B
    e$BH/@8$7$?$H$-e(B [FATAL] exception reentered e$B$K$J$C$F$7$^$&e(B

  • [FATAL] exception reentered e$B$G%(%i!<$,I=<($5$l$J$$e(B

e$BA0<T$OIaDL$N%W%m%0%i%`$G$b$?$^$K5/$-$=$&$J$s$G$9$,!"$I$&BP=he(B
e$B$7$?$b$N$+$o$+$j$^$;$s!#3d$j9~$_=hM}$rCY1d$9$k%U%i%0$,I,MW!)e(B

e$BBP=h$7$F$_$^$7$?!#e(B

e$B8e<T$OB?J,0J2<$G$J$s$H$+$J$k$H;W$$$^$9!#e(Berror_print e$B$ONc30$Ne(B
e$BH/@8$K5$$r;H$$$^$/$C$F$k$h$&$J$N$GBg>fIW$=$&$@$H;W$$$^$7$?$,!“e(B
[ruby-core:1122] e$B$N$h$&$KNc30$G:F5”$7$Fe(B SEGV e$B$9$k$h$&$JNc$,e(B
e$B$"$C$?$i$9$_$^$;$s!#e(B

e$B:F5"%A%’%C%/$^$G30$7$F$7$^$&$N$O$A$g$C$H$^$:$$$h$&$J5$$,$7$^$9!#e(B