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

ruby-changes:39184

From: ngoto <ko1@a...>
Date: Thu, 16 Jul 2015 21:09:13 +0900 (JST)
Subject: [ruby-changes:39184] ngoto:r51265 (trunk): Revert r51209 because signals after stopping timer thread before

ngoto	2015-07-16 21:08:56 +0900 (Thu, 16 Jul 2015)

  New Revision: 51265

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

  Log:
    Revert r51209 because signals after stopping timer thread before
    entering exec(2) system call may be lost.

  Modified files:
    trunk/ChangeLog
    trunk/process.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 51264)
+++ ChangeLog	(revision 51265)
@@ -206,14 +206,6 @@ Fri Jul 10 22:05:50 2015  Nobuyoshi Naka https://github.com/ruby/ruby/blob/trunk/ChangeLog#L206
 	  and use Timeout::Error instead, as using throw/catch to isolate
 	  each timeouts now.  [ruby-dev:49179] [Bug #11344]
 
-Fri Jul 10 20:13:05 2015  Naohisa Goto  <ngotogenome@g...>
-
-	* process.c (rb_f_exec): rb_exec_without_timer_thread should be
-	  used on every OS, not only on Mac OS X or Haiku, to prevent
-	  timer thread communications using file descriptor 3 after
-	  setting redirection of the fd 3 before calling exec.
-	  [Bug #11336] [ruby-core:69886]
-
 Fri Jul 10 17:41:54 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* dir.c (is_case_sensitive): get attributes by the file descriptor
Index: process.c
===================================================================
--- process.c	(revision 51264)
+++ process.c	(revision 51265)
@@ -2484,7 +2484,9 @@ rb_execarg_parent_end(VALUE execarg_obj) https://github.com/ruby/ruby/blob/trunk/process.c#L2484
     RB_GC_GUARD(execarg_obj);
 }
 
+#if defined(__APPLE__) || defined(__HAIKU__)
 static int rb_exec_without_timer_thread(const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen);
+#endif
 
 /*
  *  call-seq:
@@ -2572,7 +2574,13 @@ rb_f_exec(int argc, const VALUE *argv) https://github.com/ruby/ruby/blob/trunk/process.c#L2574
     rb_execarg_parent_start(execarg_obj);
     fail_str = eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name;
 
+#if defined(__APPLE__) || defined(__HAIKU__)
     rb_exec_without_timer_thread(eargp, errmsg, sizeof(errmsg));
+#else
+    before_exec_async_signal_safe(); /* async-signal-safe */
+    rb_exec_async_signal_safe(eargp, errmsg, sizeof(errmsg));
+    preserving_errno(after_exec_async_signal_safe()); /* async-signal-safe */
+#endif
     RB_GC_GUARD(execarg_obj);
     if (errmsg[0])
         rb_sys_fail(errmsg);
@@ -3080,6 +3088,7 @@ failure: https://github.com/ruby/ruby/blob/trunk/process.c#L3088
     return -1;
 }
 
+#if defined(__APPLE__) || defined(__HAIKU__)
 static int
 rb_exec_without_timer_thread(const struct rb_execarg *eargp, char *errmsg, size_t errmsg_buflen)
 {
@@ -3089,6 +3098,7 @@ rb_exec_without_timer_thread(const struc https://github.com/ruby/ruby/blob/trunk/process.c#L3098
     preserving_errno(after_exec()); /* not async-signal-safe because it calls rb_thread_start_timer_thread.  */
     return ret;
 }
+#endif
 
 #ifdef HAVE_WORKING_FORK
 /* This function should be async-signal-safe.  Hopefully it is. */

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

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