[前][次][番号順一覧][スレッド一覧]

ruby-changes:34439

From: nagachika <ko1@a...>
Date: Tue, 24 Jun 2014 00:02:35 +0900 (JST)
Subject: [ruby-changes:34439] nagachika:r46520 (ruby_2_1): merge revision(s) r46194: [Backport #9835]

nagachika	2014-06-24 00:02:21 +0900 (Tue, 24 Jun 2014)

  New Revision: 46520

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46520

  Log:
    merge revision(s) r46194: [Backport #9835]
    
    * signal.c (signal_exec): ignore immediate cmd for SIG_IGN
    
    * signal.c (trap_handler): set cmd to true for SIG_IGN
    
    * signal.c (trap): handle nil and true values for oldcmd
      [Bug #9835]

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/signal.c
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 46519)
+++ ruby_2_1/ChangeLog	(revision 46520)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Mon Jun 23 23:56:54 2014  Eric Wong  <e@8...>
+
+	* signal.c (signal_exec): ignore immediate cmd for SIG_IGN
+	* signal.c (trap_handler): set cmd to true for SIG_IGN
+	* signal.c (trap): handle nil and true values for oldcmd
+	  [Bug #9835]
+
 Mon Jun 23 02:46:14 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* class.c (rb_mod_init_copy): always clear instance variable,
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 46519)
+++ ruby_2_1/version.h	(revision 46520)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.2"
 #define RUBY_RELEASE_DATE "2014-06-23"
-#define RUBY_PATCHLEVEL 137
+#define RUBY_PATCHLEVEL 138
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 6
Index: ruby_2_1/signal.c
===================================================================
--- ruby_2_1/signal.c	(revision 46519)
+++ ruby_2_1/signal.c	(revision 46520)
@@ -740,6 +740,15 @@ signal_exec(VALUE cmd, int safe, int sig https://github.com/ruby/ruby/blob/trunk/ruby_2_1/signal.c#L740
     volatile unsigned long old_interrupt_mask = cur_th->interrupt_mask;
     int state;
 
+    /*
+     * workaround the following race:
+     * 1. signal_enque queues signal for execution
+     * 2. user calls trap(sig, "IGNORE"), setting SIG_IGN
+     * 3. rb_signal_exec runs on queued signal
+     */
+    if (IMMEDIATE_P(cmd))
+	return;
+
     cur_th->interrupt_mask |= TRAP_INTERRUPT_MASK;
     TH_PUSH_TAG(cur_th);
     if ((state = EXEC_TAG()) == 0) {
@@ -891,7 +900,7 @@ trap_handler(VALUE *cmd, int sig) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/signal.c#L900
 		if (strncmp(RSTRING_PTR(command), "SIG_IGN", 7) == 0) {
 sig_ign:
                     func = SIG_IGN;
-                    *cmd = 0;
+                    *cmd = Qtrue;
 		}
 		else if (strncmp(RSTRING_PTR(command), "SIG_DFL", 7) == 0) {
 sig_dfl:
@@ -972,10 +981,13 @@ trap(int sig, sighandler_t func, VALUE c https://github.com/ruby/ruby/blob/trunk/ruby_2_1/signal.c#L981
     oldcmd = vm->trap_list[sig].cmd;
     switch (oldcmd) {
       case 0:
+      case Qtrue:
 	if (oldfunc == SIG_IGN) oldcmd = rb_str_new2("IGNORE");
 	else if (oldfunc == sighandler) oldcmd = rb_str_new2("DEFAULT");
 	else oldcmd = Qnil;
 	break;
+      case Qnil:
+	break;
       case Qundef:
 	oldcmd = rb_str_new2("EXIT");
 	break;

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r46194


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]