ruby-changes:34437
From: usa <ko1@a...>
Date: Mon, 23 Jun 2014 18:50:35 +0900 (JST)
Subject: [ruby-changes:34437] usa:r46518 (ruby_2_0_0): merge revision(s) 45899: [Backport #9751]
usa 2014-06-23 18:50:21 +0900 (Mon, 23 Jun 2014) New Revision: 46518 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46518 Log: merge revision(s) 45899: [Backport #9751] * thread.c (thread_start_func_2): stop if forked in a sub-thread, the thread has become the main thread. [ruby-core:62070] [Bug #9751] Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/test/ruby/test_thread.rb branches/ruby_2_0_0/thread.c branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 46517) +++ ruby_2_0_0/ChangeLog (revision 46518) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Mon Jun 23 18:50:13 2014 Nobuyoshi Nakada <nobu@r...> + + * thread.c (thread_start_func_2): stop if forked in a sub-thread, + the thread has become the main thread. + [ruby-core:62070] [Bug #9751] + Mon Jun 23 18:35:34 2014 Josh Goebel <dreamer3@g...> * net/protocol.rb (using_each_crlf_line): fix SMTP dot-stuffing Index: ruby_2_0_0/thread.c =================================================================== --- ruby_2_0_0/thread.c (revision 46517) +++ ruby_2_0_0/thread.c (revision 46518) @@ -552,6 +552,9 @@ thread_start_func_2(rb_thread_t *th, VAL https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/thread.c#L552 thread_debug("thread end: %p\n", (void *)th); main_th = th->vm->main_thread; + if (main_th == th) { + ruby_stop(0); + } if (RB_TYPE_P(errinfo, T_OBJECT)) { /* treat with normal error object */ rb_threadptr_raise(main_th, 1, &errinfo); Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 46517) +++ ruby_2_0_0/version.h (revision 46518) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2014-06-23" -#define RUBY_PATCHLEVEL 497 +#define RUBY_PATCHLEVEL 498 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 6 Index: ruby_2_0_0/test/ruby/test_thread.rb =================================================================== --- ruby_2_0_0/test/ruby/test_thread.rb (revision 46517) +++ ruby_2_0_0/test/ruby/test_thread.rb (revision 46518) @@ -964,4 +964,25 @@ Thread.new(Thread.current) {|mth| https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_thread.rb#L964 pid, status = Process.waitpid2(pid) assert_equal(false, status.success?, bug8433) end if Process.respond_to?(:fork) + + def test_fork_in_thread + bug9751 = '[ruby-core:62070] [Bug #9751]' + f = nil + th = Thread.start do + unless f = IO.popen("-") + STDERR.reopen(STDOUT) + exit + end + Process.wait2(f.pid) + end + unless th.join(3) + Process.kill(:QUIT, f.pid) + Process.kill(:KILL, f.pid) unless th.join(1) + end + _, status = th.value + output = f.read + f.close + assert_not_predicate(status, :signaled?, FailDesc[status, bug9751, output]) + assert_predicate(status, :success?, bug9751) + end if Process.respond_to?(:fork) end Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r45899 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/