From 94f6066440db048111f2b47841a56b59c4a1abfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Fri, 22 Dec 2023 14:20:46 +0100 Subject: [PATCH] Upgrade to Ruby 3.3.0 (bcb4706dac). --- ...ocations-in-Hash-compare_by_identity.patch | 92 +++++++++++++++++++ ruby.spec | 16 ++-- 2 files changed, 102 insertions(+), 6 deletions(-) create mode 100644 ruby-3.3.0-Revert-Optimize-allocations-in-Hash-compare_by_identity.patch diff --git a/ruby-3.3.0-Revert-Optimize-allocations-in-Hash-compare_by_identity.patch b/ruby-3.3.0-Revert-Optimize-allocations-in-Hash-compare_by_identity.patch new file mode 100644 index 0000000..9baaf27 --- /dev/null +++ b/ruby-3.3.0-Revert-Optimize-allocations-in-Hash-compare_by_identity.patch @@ -0,0 +1,92 @@ +From 8944a064d0fd7947b8c2b6c761be3e3a0c9073af Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?V=C3=ADt=20Ondruch?= +Date: Fri, 22 Dec 2023 14:16:48 +0100 +Subject: [PATCH 1/2] Revert "compare_by_identity: remove alloc for non-empty + Hash" + +This reverts commit 11fa76b1b521072c200c78ea023960221ff426d6. +--- + hash.c | 13 ++++--------- + 1 file changed, 4 insertions(+), 9 deletions(-) + +diff --git a/hash.c b/hash.c +index 78e9d9a2d6..f6525ba4a5 100644 +--- a/hash.c ++++ b/hash.c +@@ -4377,16 +4377,13 @@ rb_hash_compare_by_id(VALUE hash) + if (hash_iterating_p(hash)) { + rb_raise(rb_eRuntimeError, "compare_by_identity during iteration"); + } ++ ar_force_convert_table(hash, __FILE__, __LINE__); ++ HASH_ASSERT(RHASH_ST_TABLE_P(hash)); + + if (RHASH_TABLE_EMPTY_P(hash)) { + // Fast path: There's nothing to rehash, so we don't need a `tmp` table. +- // We're most likely an AR table, so this will need an allocation. +- ar_force_convert_table(hash, __FILE__, __LINE__); +- HASH_ASSERT(RHASH_ST_TABLE_P(hash)); +- + RHASH_ST_TABLE(hash)->type = &identhash; +- } +- else { ++ } else { + // Slow path: Need to rehash the members of `self` into a new + // `tmp` table using the new `identhash` compare/hash functions. + tmp = hash_alloc(0); +@@ -4394,10 +4391,8 @@ rb_hash_compare_by_id(VALUE hash) + identtable = RHASH_ST_TABLE(tmp); + + rb_hash_foreach(hash, rb_hash_rehash_i, (VALUE)tmp); +- rb_hash_free(hash); + +- // We know for sure `identtable` is an st table, +- // so we can skip `ar_force_convert_table` here. ++ rb_hash_free(hash); + RHASH_ST_TABLE_SET(hash, identtable); + RHASH_ST_CLEAR(tmp); + } + +From f5c415300ffe63e41e46c6b88b8634a3bad0c7c2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?V=C3=ADt=20Ondruch?= +Date: Fri, 22 Dec 2023 14:17:14 +0100 +Subject: [PATCH 2/2] Revert "compare_by_identity: remove alloc for empty Hash" + +This reverts commit b5c6c0122f5b010cb5f43e7a236c4ba2b1d56a2a. +--- + hash.c | 21 +++++++-------------- + 1 file changed, 7 insertions(+), 14 deletions(-) + +diff --git a/hash.c b/hash.c +index f6525ba4a5..cf83675c70 100644 +--- a/hash.c ++++ b/hash.c +@@ -4380,22 +4380,15 @@ rb_hash_compare_by_id(VALUE hash) + ar_force_convert_table(hash, __FILE__, __LINE__); + HASH_ASSERT(RHASH_ST_TABLE_P(hash)); + +- if (RHASH_TABLE_EMPTY_P(hash)) { +- // Fast path: There's nothing to rehash, so we don't need a `tmp` table. +- RHASH_ST_TABLE(hash)->type = &identhash; +- } else { +- // Slow path: Need to rehash the members of `self` into a new +- // `tmp` table using the new `identhash` compare/hash functions. +- tmp = hash_alloc(0); +- hash_st_table_init(tmp, &identhash, RHASH_SIZE(hash)); +- identtable = RHASH_ST_TABLE(tmp); ++ tmp = hash_alloc(0); ++ hash_st_table_init(tmp, &identhash, RHASH_SIZE(hash)); ++ identtable = RHASH_ST_TABLE(tmp); + +- rb_hash_foreach(hash, rb_hash_rehash_i, (VALUE)tmp); ++ rb_hash_foreach(hash, rb_hash_rehash_i, (VALUE)tmp); + +- rb_hash_free(hash); +- RHASH_ST_TABLE_SET(hash, identtable); +- RHASH_ST_CLEAR(tmp); +- } ++ rb_hash_free(hash); ++ RHASH_ST_TABLE_SET(hash, identtable); ++ RHASH_ST_CLEAR(tmp); + + return hash; + } diff --git a/ruby.spec b/ruby.spec index 6da0ff6..32beeb1 100644 --- a/ruby.spec +++ b/ruby.spec @@ -10,7 +10,7 @@ #%%global milestone rc1 # Keep the revision enabled for pre-releases from GIT. -%global revision bcb4706dac +%global revision e8639098ed %global ruby_archive %{name}-%{ruby_version} @@ -27,7 +27,7 @@ %global rubygems_dir %{_datadir}/rubygems # Bundled libraries versions -%global rubygems_version 3.5.1 +%global rubygems_version 3.5.2 %global rubygems_molinillo_version 0.8.0 %global rubygems_net_http_version 0.4.0 %global rubygems_net_protocol_version 0.2.2 @@ -37,7 +37,7 @@ %global rubygems_tsort_version 0.2.0 # Default gems. -%global bundler_version 2.5.1 +%global bundler_version 2.5.2 %global bundler_connection_pool_version 2.4.1 %global bundler_fileutils_version 1.7.2 %global bundler_net_http_persistent_version 4.0.2 @@ -120,7 +120,7 @@ %global rdoc_version 6.6.2 # Bundled gems. -%global debug_version 1.9.0 +%global debug_version 1.9.1 %global net_ftp_version 0.3.3 %global net_imap_version 0.4.8 %global net_pop_version 0.1.2 @@ -232,6 +232,9 @@ Patch6: ruby-2.7.0-Initialize-ABRT-hook.patch # Disable syntax_suggest test suite, which tries to download its dependencies. # https://bugs.ruby-lang.org/issues/19297 Patch9: ruby-3.3.0-Disable-syntax-suggest-test-case.patch +# Revert patches causing segfaults in alexandria package. +# https://bugs.ruby-lang.org/issues/20079 +Patch10: ruby-3.3.0-Revert-Optimize-allocations-in-Hash-compare_by_identity.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} %{?with_rubypick:Suggests: rubypick} @@ -701,6 +704,7 @@ analysis result in RBS format, a standard type description format for Ruby %patch 4 -p1 %patch 6 -p1 %patch 9 -p1 +%patch 10 -p1 # Provide an example of usage of the tapset: cp -a %{SOURCE3} . @@ -1636,8 +1640,8 @@ make -C %{_vpath_builddir} runruby TESTRUN_SCRIPT=" \ %changelog -* Thu Dec 21 2023 Vít Ondruch - 3.3.0-184 -- Upgrade to Ruby 3.3.0 (bcb4706dac). +* Fri Dec 22 2023 Vít Ondruch - 3.3.0-184 +- Upgrade to Ruby 3.3.0 (e8639098ed). * Thu Nov 09 2023 Jun Aruga - 3.2.2-183 - ssl: use ffdhe2048 from RFC 7919 as the default DH group parameters