ruby-changes:34416
From: nagachika <ko1@a...>
Date: Mon, 23 Jun 2014 02:44:41 +0900 (JST)
Subject: [ruby-changes:34416] nagachika:r46497 (ruby_2_1): merge revision(s) r45899: [Backport #9751]
nagachika 2014-06-23 02:44:28 +0900 (Mon, 23 Jun 2014) New Revision: 46497 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46497 Log: merge revision(s) r45899: [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_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/test/ruby/test_thread.rb branches/ruby_2_1/thread.c branches/ruby_2_1/version.h Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 46496) +++ ruby_2_1/ChangeLog (revision 46497) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Mon Jun 23 02:36:04 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 01:53:18 2014 Josh Goebel <dreamer3@g...> * net/protocol.rb (using_each_crlf_line): fix SMTP dot-stuffing Index: ruby_2_1/thread.c =================================================================== --- ruby_2_1/thread.c (revision 46496) +++ ruby_2_1/thread.c (revision 46497) @@ -569,6 +569,9 @@ thread_start_func_2(rb_thread_t *th, VAL https://github.com/ruby/ruby/blob/trunk/ruby_2_1/thread.c#L569 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_1/version.h =================================================================== --- ruby_2_1/version.h (revision 46496) +++ ruby_2_1/version.h (revision 46497) @@ -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 135 +#define RUBY_PATCHLEVEL 136 #define RUBY_RELEASE_YEAR 2014 #define RUBY_RELEASE_MONTH 6 Index: ruby_2_1/test/ruby/test_thread.rb =================================================================== --- ruby_2_1/test/ruby/test_thread.rb (revision 46496) +++ ruby_2_1/test/ruby/test_thread.rb (revision 46497) @@ -969,4 +969,25 @@ Thread.new(Thread.current) {|mth| https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_thread.rb#L969 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_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r45899 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/