ruby-changes:47401
From: nagachika <ko1@a...>
Date: Sat, 5 Aug 2017 15:46:29 +0900 (JST)
Subject: [ruby-changes:47401] nagachika:r59517 (ruby_2_4): merge revision(s) 59368: [Backport #13753]
nagachika 2017-08-05 15:46:23 +0900 (Sat, 05 Aug 2017) New Revision: 59517 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59517 Log: merge revision(s) 59368: [Backport #13753] random.c: ensure initialized * random.c (get_rnd, try_get_rnd): ensure initialized to get rid of crash in forked processes. [ruby-core:82100] [Bug #13753] Modified directories: branches/ruby_2_4/ Modified files: branches/ruby_2_4/random.c branches/ruby_2_4/test/ruby/test_rand.rb branches/ruby_2_4/version.h Index: ruby_2_4/random.c =================================================================== --- ruby_2_4/random.c (revision 59516) +++ ruby_2_4/random.c (revision 59517) @@ -338,7 +338,7 @@ get_rnd(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ruby_2_4/random.c#L338 { rb_random_t *ptr; TypedData_Get_Struct(obj, rb_random_t, &random_data_type, ptr); - return ptr; + return rand_start(ptr); } static rb_random_t * @@ -348,7 +348,7 @@ try_get_rnd(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ruby_2_4/random.c#L348 return rand_start(&default_rand); } if (!rb_typeddata_is_kind_of(obj, &random_data_type)) return NULL; - return DATA_PTR(obj); + return rand_start(DATA_PTR(obj)); } /* :nodoc: */ Index: ruby_2_4/version.h =================================================================== --- ruby_2_4/version.h (revision 59516) +++ ruby_2_4/version.h (revision 59517) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_4/version.h#L1 #define RUBY_VERSION "2.4.2" #define RUBY_RELEASE_DATE "2017-08-05" -#define RUBY_PATCHLEVEL 179 +#define RUBY_PATCHLEVEL 180 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 8 Index: ruby_2_4/test/ruby/test_rand.rb =================================================================== --- ruby_2_4/test/ruby/test_rand.rb (revision 59516) +++ ruby_2_4/test/ruby/test_rand.rb (revision 59517) @@ -453,6 +453,10 @@ END https://github.com/ruby/ruby/blob/trunk/ruby_2_4/test/ruby/test_rand.rb#L453 assert_fork_status(1, bug5661) {stable.rand(4)} r1, r2 = *assert_fork_status(2, bug5661) {stable.rand} assert_equal(r1, r2, bug5661) + + assert_fork_status(1, '[ruby-core:82100] [Bug #13753]') do + Random::DEFAULT.rand(4) + end rescue NotImplementedError end Index: ruby_2_4 =================================================================== --- ruby_2_4 (revision 59516) +++ ruby_2_4 (revision 59517) Property changes on: ruby_2_4 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r59368 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/