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

ruby-changes:59260

From: nagachika <ko1@a...>
Date: Sun, 15 Dec 2019 19:07:09 +0900 (JST)
Subject: [ruby-changes:59260] d1a33d8ec5 (ruby_2_6): merge revision(s) 203b7fa1ae8cc40d41c38d684f70b3fea7fae813,0131fab749fb76800de09e49a6abf910201c5b58,9c0cd5c569ba22bc68d1a77ad6580a275cd99639,c144d7215b3444fa36d28d540b60170a5b30743d: [Backport #16196]

https://git.ruby-lang.org/ruby.git/commit/?id=d1a33d8ec5

From d1a33d8ec514e24cbda8c62ab529b3920f0f97f4 Mon Sep 17 00:00:00 2001
From: nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
Date: Sun, 15 Dec 2019 08:12:17 +0000
Subject: merge revision(s)
 203b7fa1ae8cc40d41c38d684f70b3fea7fae813,0131fab749fb76800de09e49a6abf910201c5b58,9c0cd5c569ba22bc68d1a77ad6580a275cd99639,c144d7215b3444fa36d28d540b60170a5b30743d:
 [Backport #16196]

	Guard static variable first

	* ext/openssl/ossl_asn1.c (Init_ossl_asn1): register the static
	  variable to grab an internal object, before creating the object.
	  otherwise the just-created object could get collected during the
	  global variable list allocation.  [Bug #16196]

	Slimed down test runtime by stressing openssl.so only [Bug #16196]


	Prefer rb_gc_register_mark_object

	* ext/openssl/ossl_asn1.c (Init_ossl_asn1): prefer
	  `rb_gc_register_mark_object`, which is better for constant
	  objects, over `rb_gc_register_address` for global/static
	  variables which can be re-assigned at runtime.  [Bug #16196]

	Skip very time consuming test [Bug #16196]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index ab45bd8..0085d4b 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -1824,7 +1824,7 @@ do{\ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_asn1.c#L1824
     rb_define_method(cASN1EndOfContent, "to_der", ossl_asn1eoc_to_der, 0);
 
     class_tag_map = rb_hash_new();
-    rb_global_variable(&class_tag_map);
+    rb_gc_register_mark_object(class_tag_map);
     rb_hash_aset(class_tag_map, cASN1EndOfContent, INT2NUM(V_ASN1_EOC));
     rb_hash_aset(class_tag_map, cASN1Boolean, INT2NUM(V_ASN1_BOOLEAN));
     rb_hash_aset(class_tag_map, cASN1Integer, INT2NUM(V_ASN1_INTEGER));
diff --git a/test/openssl/test_asn1.rb b/test/openssl/test_asn1.rb
index 1170703..cc11301 100644
--- a/test/openssl/test_asn1.rb
+++ b/test/openssl/test_asn1.rb
@@ -635,6 +635,11 @@ class  OpenSSL::TestASN1 < OpenSSL::TestCase https://github.com/ruby/ruby/blob/trunk/test/openssl/test_asn1.rb#L635
     assert_equal data, seq.entries
   end
 
+  def test_gc_stress
+    skip "very time consuming test"
+    assert_ruby_status(['--disable-gems', '-eGC.stress=true', '-erequire "openssl.so"'])
+  end
+
   private
 
   def B(ary)
diff --git a/version.h b/version.h
index 4ace00f..1ff90df 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L1
 #define RUBY_VERSION "2.6.6"
 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 121
+#define RUBY_PATCHLEVEL 122
 
 #define RUBY_RELEASE_YEAR 2019
 #define RUBY_RELEASE_MONTH 12
-- 
cgit v0.10.2


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

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