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

ruby-changes:35874

From: nagachika <ko1@a...>
Date: Thu, 16 Oct 2014 00:18:19 +0900 (JST)
Subject: [ruby-changes:35874] nagachika:r47956 (ruby_2_1): merge revision(s) r47818, r47832: [Backport #9820]

nagachika	2014-10-16 00:18:04 +0900 (Thu, 16 Oct 2014)

  New Revision: 47956

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

  Log:
    merge revision(s) r47818,r47832: [Backport #9820]
    
    * signal.c (rb_f_kill): should not ignore signal unless the
      default handler is registered.  [ruby-dev:48592] [Bug #9820]
    
    * signal.c (rb_f_kill): get rid of deadlock as unhandled and
      discarded signals do not make interrupt_cond signaled.
      based on the patch by Kazuki Tsujimoto at [ruby-dev:48606].
      [Bug #9820]

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/signal.c
    branches/ruby_2_1/test/ruby/test_signal.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 47955)
+++ ruby_2_1/ChangeLog	(revision 47956)
@@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Thu Oct 16 00:10:45 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* signal.c (rb_f_kill): get rid of deadlock as unhandled and
+	  discarded signals do not make interrupt_cond signaled.
+	  based on the patch by Kazuki Tsujimoto at [ruby-dev:48606].
+	  [Bug #9820]
+
+Thu Oct 16 00:10:45 2014  Nobuyoshi Nakada  <nobu@r...>
+
+	* signal.c (rb_f_kill): should not ignore signal unless the
+	  default handler is registered.  [ruby-dev:48592] [Bug #9820]
+
 Wed Oct 15 23:58:13 2014  CHIKANAGA Tomoyuki  <nagachika@r...>
 
 	merge r47598 partially. extracted commits are as follows. [Bug #9728]
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 47955)
+++ ruby_2_1/version.h	(revision 47956)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.4"
 #define RUBY_RELEASE_DATE "2014-10-16"
-#define RUBY_PATCHLEVEL 254
+#define RUBY_PATCHLEVEL 255
 
 #define RUBY_RELEASE_YEAR 2014
 #define RUBY_RELEASE_MONTH 10
Index: ruby_2_1/test/ruby/test_signal.rb
===================================================================
--- ruby_2_1/test/ruby/test_signal.rb	(revision 47955)
+++ ruby_2_1/test/ruby/test_signal.rb	(revision 47956)
@@ -278,5 +278,17 @@ EOS https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_signal.rb#L278
         Process.kill(:INT, $$)
       end
     end;
+
+    if trap = Signal.list['TRAP']
+      bug9820 = '[ruby-dev:48592] [Bug #9820]'
+      status = assert_in_out_err(['-e', 'Process.kill(:TRAP, $$)'])
+      assert_predicate(status, :signaled?, bug9820)
+      assert_equal(trap, status.termsig, bug9820)
+    end
+
+    if Signal.list['CONT']
+      bug9820 = '[ruby-dev:48606] [Bug #9820]'
+      assert_ruby_status(['-e', 'Process.kill(:CONT, $$)'])
+    end
   end if Process.respond_to?(:kill)
 end
Index: ruby_2_1/signal.c
===================================================================
--- ruby_2_1/signal.c	(revision 47955)
+++ ruby_2_1/signal.c	(revision 47956)
@@ -343,6 +343,7 @@ ruby_default_signal(int sig) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/signal.c#L343
     raise(sig);
 }
 
+static RETSIGTYPE sighandler(int sig);
 static int signal_ignored(int sig);
 static void signal_enque(int sig);
 
@@ -449,6 +450,7 @@ rb_f_kill(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/signal.c#L450
 	    rb_pid_t pid = NUM2PIDT(argv[i]);
 
 	    if ((sig != 0) && (self != -1) && (pid == self)) {
+		int t;
 		/*
 		 * When target pid is self, many caller assume signal will be
 		 * delivered immediately and synchronously.
@@ -467,7 +469,12 @@ rb_f_kill(int argc, VALUE *argv) https://github.com/ruby/ruby/blob/trunk/ruby_2_1/signal.c#L469
 		    ruby_kill(pid, sig);
 		    break;
 		  default:
-		    if (signal_ignored(sig)) break;
+		    t = signal_ignored(sig);
+		    if (t) {
+			if (t < 0 && kill(pid, sig))
+			    rb_sys_fail(0);
+			break;
+		    }
 		    signal_enque(sig);
 		    wakeup = 1;
 		}
@@ -612,16 +619,19 @@ ruby_nativethread_signal(int signum, sig https://github.com/ruby/ruby/blob/trunk/ruby_2_1/signal.c#L619
 static int
 signal_ignored(int sig)
 {
+    sighandler_t func;
 #ifdef POSIX_SIGNAL
     struct sigaction old;
     (void)VALGRIND_MAKE_MEM_DEFINED(&old, sizeof(old));
     if (sigaction(sig, NULL, &old) < 0) return FALSE;
-    return old.sa_handler == SIG_IGN;
+    func = old.sa_handler;
 #else
     sighandler_t old = signal(sig, SIG_DFL);
     signal(sig, old);
-    return old == SIG_IGN;
+    func = old;
 #endif
+    if (func == SIG_IGN) return 1;
+    return func == sighandler ? 0 : -1;
 }
 
 static void

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r47818,47832


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

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