Upgrade to Ruby 3.0.1.

This commit is contained in:
Vít Ondruch 2021-04-06 12:51:08 +02:00
parent fd8c8ee765
commit 9e656cf658
8 changed files with 23 additions and 236 deletions

View File

@ -237,7 +237,7 @@ diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index b25068405d..e9fef4a311 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1369,7 +1369,8 @@ def test_self_use_paths
@@ -1452,7 +1452,8 @@ def test_self_use_paths
def test_self_user_dir
parts = [@userhome, '.gem', Gem.ruby_engine]
@ -247,7 +247,7 @@ index b25068405d..e9fef4a311 100644
FileUtils.mkdir_p File.join(parts)
@@ -1447,7 +1448,7 @@ def test_self_vendor_dir
@@ -1530,7 +1531,7 @@ def test_self_vendor_dir
vendordir(File.join(@tempdir, 'vendor')) do
expected =
File.join RbConfig::CONFIG['vendordir'], 'gems',

View File

@ -1,24 +0,0 @@
From 265c0022390e3dcd4ff692fc77d29b94e652c877 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@ruby-lang.org>
Date: Tue, 9 Feb 2021 01:00:00 +0900
Subject: [PATCH] Do not allocate ractor-local storage in dfree function during
GC
---
random.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/random.c b/random.c
index c11cd803f2cb..83df6d1eb537 100644
--- a/random.c
+++ b/random.c
@@ -257,7 +257,8 @@ const rb_data_type_t rb_random_data_type = {
static void
random_mt_free(void *ptr)
{
- if (ptr != default_rand())
+ rb_random_mt_t *rnd = rb_ractor_local_storage_ptr(default_rand_key);
+ if (ptr != rnd)
xfree(ptr);
}

View File

@ -1,31 +0,0 @@
From 0b54279d63c4be355e0ce9cc0b81e3df75045791 Mon Sep 17 00:00:00 2001
From: Aaron Patterson <tenderlove@ruby-lang.org>
Date: Fri, 15 Jan 2021 14:14:43 -0800
Subject: [PATCH] Don't try to clear cache on garbage objects
Method cache can be cleared during lazy sweeping. An object that will
be collected during lazy sweep *should not* have it's method cache
cleared. Soon-to-be-collected objects can be in an inconsistent state and
this can lead to a crash. This patch just leaves early if the object is
going to be collected.
Fixes [Bug #17536]
Co-Authored-By: John Hawthorn <john@hawthorn.email>
Co-Authored-By: Alan Wu <XrXr@users.noreply.github.com>
---
vm_method.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/vm_method.c b/vm_method.c
index 287d4aee6dea..81920bbe5bfb 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -136,6 +136,7 @@ static void
clear_method_cache_by_id_in_class(VALUE klass, ID mid)
{
VM_ASSERT(RB_TYPE_P(klass, T_CLASS) || RB_TYPE_P(klass, T_ICLASS));
+ if (rb_objspace_garbage_object_p(klass)) return;
if (LIKELY(RCLASS_EXT(klass)->subclasses == NULL)) {
// no subclasses

View File

@ -1,30 +0,0 @@
From f690eb34e28b000627e5f0649dd81a04e252286f Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@ruby-lang.org>
Date: Sat, 2 Jan 2021 12:11:52 +0900
Subject: [PATCH] Fixed dangling imemo_tmpbuf
The count of rb_alloc_tmp_buffer_with_count is the allocation size
counted in VALUE size but not in the requested element size.
Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
Co-authored-by: Koichi Sasada <ko1@atdot.net>
---
include/ruby/internal/memory.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/ruby/internal/memory.h b/include/ruby/internal/memory.h
index 974c21e19ce8..7d24df494512 100644
--- a/include/ruby/internal/memory.h
+++ b/include/ruby/internal/memory.h
@@ -250,8 +250,9 @@ rbimpl_size_mul_or_raise(size_t x, size_t y)
static inline void *
rb_alloc_tmp_buffer2(volatile VALUE *store, long count, size_t elsize)
{
- return rb_alloc_tmp_buffer_with_count(
- store, rbimpl_size_mul_or_raise(count, elsize), count);
+ const size_t total_size = rbimpl_size_mul_or_raise(count, elsize);
+ const size_t cnt = (total_size + sizeof(VALUE) - 1) / sizeof(VALUE);
+ return rb_alloc_tmp_buffer_with_count(store, total_size, cnt);
}
#ifndef __MINGW32__

View File

@ -1,65 +0,0 @@
From 85310ad82ede533681c4f8a423cc8f140e6adf76 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@ruby-lang.org>
Date: Tue, 9 Feb 2021 10:08:30 +0900
Subject: [PATCH 1/2] Also `eclass` loop can raise in `rb_obj_is_kind_of`
---
eval.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eval.c b/eval.c
index 56d7c2b81c93..2c9e375e2545 100644
--- a/eval.c
+++ b/eval.c
@@ -1034,6 +1034,7 @@ rb_vrescue2(VALUE (* b_proc) (VALUE), VALUE data1,
int handle = FALSE;
VALUE eclass;
+ result = Qnil;
while ((eclass = va_arg(args, VALUE)) != 0) {
if (rb_obj_is_kind_of(ec->errinfo, eclass)) {
handle = TRUE;
@@ -1042,7 +1043,6 @@ rb_vrescue2(VALUE (* b_proc) (VALUE), VALUE data1,
}
if (handle) {
- result = Qnil;
state = 0;
if (r_proc) {
result = (*r_proc) (data2, ec->errinfo);
From 601d38efa21dbed0084629d909752e52e3d6092d Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@ruby-lang.org>
Date: Tue, 9 Feb 2021 00:42:12 +0900
Subject: [PATCH 2/2] Copy va_list of exception classes
The list is reused when an exception raised again after retrying
in the rescue procedure.
---
eval.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/eval.c b/eval.c
index 2c9e375e2545..55d66b550854 100644
--- a/eval.c
+++ b/eval.c
@@ -1033,14 +1033,18 @@ rb_vrescue2(VALUE (* b_proc) (VALUE), VALUE data1,
if (state == TAG_RAISE) {
int handle = FALSE;
VALUE eclass;
+ va_list ap;
result = Qnil;
- while ((eclass = va_arg(args, VALUE)) != 0) {
+ /* reuses args when raised again after retrying in r_proc */
+ va_copy(ap, args);
+ while ((eclass = va_arg(ap, VALUE)) != 0) {
if (rb_obj_is_kind_of(ec->errinfo, eclass)) {
handle = TRUE;
break;
}
}
+ va_end(ap);
if (handle) {
state = 0;

View File

@ -1,6 +1,6 @@
%global major_version 3
%global minor_version 0
%global teeny_version 0
%global teeny_version 1
%global major_minor_version %{major_version}.%{minor_version}
%global ruby_version %{major_minor_version}.%{teeny_version}
@ -22,7 +22,7 @@
%endif
%global release 147
%global release 148
%{!?release_string:%define release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}}
# The RubyGems library has to stay out of Ruby directory tree, since the
@ -30,24 +30,24 @@
%global rubygems_dir %{_datadir}/rubygems
# Bundled libraries versions
%global rubygems_version 3.2.3
%global rubygems_version 3.2.15
%global rubygems_molinillo_version 0.7.0
# Default gems.
%global bundler_version 2.2.3
%global bundler_version 2.2.15
%global bundler_connection_pool_version 2.2.2
%global bundler_fileutils_version 1.4.1
%global bundler_molinillo_version 0.7.0
%global bundler_net_http_persistent_version 4.0.0
%global bundler_thor_version 1.0.1
%global bundler_thor_version 1.1.0
%global bundler_tmpdir_version 0.1.0
%global bundler_uri_version 0.10.0
%global bigdecimal_version 3.0.0
%global did_you_mean_version 1.5.0
%global erb_version 2.2.0
%global io_console_version 0.5.6
%global irb_version 1.3.0
%global io_console_version 0.5.7
%global irb_version 1.3.5
%global json_version 2.5.1
%global openssl_version 2.2.0
%global psych_version 3.3.0
@ -58,11 +58,11 @@
%global minitest_version 5.14.2
%global power_assert_version 1.2.0
%global rake_version 13.0.3
%global rbs_version 1.0.0
%global rbs_version 1.0.4
%global test_unit_version 3.3.7
%global rexml_version 3.2.4
%global rexml_version 3.2.5
%global rss_version 0.2.9
%global typeprof_version 0.11.0
%global typeprof_version 0.12.0
%global tapset_libdir %(echo %{_libdir} | sed 's/64//')*
@ -146,22 +146,6 @@ Patch6: ruby-2.7.0-Initialize-ABRT-hook.patch
# hardening features of glibc (rhbz#1361037).
# https://bugs.ruby-lang.org/issues/12666
Patch9: ruby-2.3.1-Rely-on-ldd-to-detect-glibc.patch
# Fix SEGFAULT preventing rubygem-unicode to build on armv7hl.
# https://bugs.ruby-lang.org/issues/17518
Patch10: ruby-3.0.0-Fixed-dangling-imemo_tmpbuf.patch
# Fix SEGFAULT in rubygem-shoulda-matchers test suite.
# https://bugs.ruby-lang.org/issues/17536
# https://github.com/ruby/ruby/pull/4077
Patch11: ruby-3.0.0-Dont-try-to-clear-cache-on-garbage-objects.patch
# Use proper path for plugin wrappers.
# https://github.com/rubygems/rubygems/pull/4317
Patch12: rubygems-3.2.7-Generate-plugin-wrappers-with-relative-requires.patch
# Avoid ruby-spec to be stuck in "C-API Kernel function rb_rescue2".
# https://bugs.ruby-lang.org/issues/17338
Patch13: ruby-3.0.0-va_list-args-in-rb_vrescue2-is-reused.patch
# Fix flaky excon test suite.
# https://bugs.ruby-lang.org/issues/17653
Patch14: ruby-3.0.0-Do-not-allocate-ractor-local-storage-in-dfree-function-during-GC.patch
# Fix DWARF5 support.
# https://bugzilla.redhat.com/show_bug.cgi?id=1920533
# https://bugs.ruby-lang.org/issues/17585
@ -613,11 +597,6 @@ rm -rf ext/fiddle/libffi*
%patch5 -p1
%patch6 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch15 -p1
%patch19 -p1
@ -780,7 +759,11 @@ find %{buildroot}%{gem_dir}/extensions/*-%{_target_os}/%{ruby_version}/* -maxdep
|| echo "No gem binary extensions to move."
# Move man pages into proper location
mkdir -p %{buildroot}%{_mandir}/man{1,5}
mv %{buildroot}%{gem_dir}/gems/rake-%{rake_version}/doc/rake.1 %{buildroot}%{_mandir}/man1
# https://bugs.ruby-lang.org/issues/17778
cp -a %{buildroot}%{gem_dir}/gems/bundler-%{bundler_version}/lib/bundler/man/*.1 %{buildroot}%{_mandir}/man1
cp -a %{buildroot}%{gem_dir}/gems/bundler-%{bundler_version}/lib/bundler/man/*.5 %{buildroot}%{_mandir}/man5
%if %{with systemtap}
# Install a tapset and fix up the path to the library.
@ -1200,7 +1183,7 @@ MSPECOPTS=""
%{gem_dir}/specifications/default/racc-%{racc_version}.gemspec
%{gem_dir}/specifications/default/readline-0.0.2.gemspec
%{gem_dir}/specifications/default/readline-ext-0.1.1.gemspec
%{gem_dir}/specifications/default/reline-0.2.0.gemspec
%{gem_dir}/specifications/default/reline-0.2.5.gemspec
%{gem_dir}/specifications/default/resolv-0.2.0.gemspec
%{gem_dir}/specifications/default/resolv-replace-0.1.0.gemspec
%{gem_dir}/specifications/default/rinda-0.1.0.gemspec
@ -1214,7 +1197,7 @@ MSPECOPTS=""
%{gem_dir}/specifications/default/tempfile-0.1.1.gemspec
%{gem_dir}/specifications/default/time-0.1.0.gemspec
%{gem_dir}/specifications/default/timeout-0.1.1.gemspec
%{gem_dir}/specifications/default/tmpdir-0.1.1.gemspec
%{gem_dir}/specifications/default/tmpdir-0.1.2.gemspec
%{gem_dir}/specifications/default/tsort-0.1.0.gemspec
%{gem_dir}/specifications/default/tracer-0.1.1.gemspec
%{gem_dir}/specifications/default/un-0.1.0.gemspec
@ -1334,14 +1317,12 @@ MSPECOPTS=""
%files -n rubygem-rexml
%dir %{gem_dir}/gems/rexml-%{rexml_version}
%exclude %{gem_dir}/gems/rexml-%{rexml_version}/.*
%license %{gem_dir}/gems/rexml-%{rexml_version}/LICENSE.txt
%doc %{gem_dir}/gems/rexml-%{rexml_version}/NEWS.md
%doc %{gem_dir}/gems/rexml-%{rexml_version}/doc
%{gem_dir}/gems/rexml-%{rexml_version}/lib
%{gem_dir}/specifications/rexml-%{rexml_version}.gemspec
%doc %{gem_dir}/gems/rexml-%{rexml_version}/Gemfile
%doc %{gem_dir}/gems/rexml-%{rexml_version}/README.md
%doc %{gem_dir}/gems/rexml-%{rexml_version}/Rakefile
%files -n rubygem-rss
%dir %{gem_dir}/gems/rss-%{rss_version}
@ -1374,6 +1355,9 @@ MSPECOPTS=""
%changelog
* Tue Apr 06 2021 Vít Ondruch <vondruch@redhat.com> - 3.0.1-148
- Upgrade to Ruby 3.0.1.
* Thu Apr 01 2021 Vít Ondruch <vondruch@redhat.com> - 3.0.0-147
- Remove IRB dependency from rubygem-rdoc.

View File

@ -1,47 +0,0 @@
From db4157e9aa7b7f720ee06fb866b53ad11879c016 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@riseup.net>
Date: Mon, 25 Jan 2021 15:40:26 +0100
Subject: [PATCH] Generate plugin wrappers with relative requires
It shouldn't change behaviour and it fixes broken wrappers generated
with `--build-root` flag is used.
---
lib/rubygems/installer_uninstaller_utils.rb | 7 ++++++-
test/rubygems/test_gem_installer.rb | 2 ++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/rubygems/installer_uninstaller_utils.rb b/lib/rubygems/installer_uninstaller_utils.rb
index e81ed4cba38..2c8b7c635e1 100644
--- a/lib/rubygems/installer_uninstaller_utils.rb
+++ b/lib/rubygems/installer_uninstaller_utils.rb
@@ -6,11 +6,16 @@
module Gem::InstallerUninstallerUtils
def regenerate_plugins_for(spec, plugins_dir)
+ plugins = spec.plugins
+ return if plugins.empty?
+
+ require 'pathname'
+
spec.plugins.each do |plugin|
plugin_script_path = File.join plugins_dir, "#{spec.name}_plugin#{File.extname(plugin)}"
File.open plugin_script_path, 'wb' do |file|
- file.puts "require '#{plugin}'"
+ file.puts "require_relative '#{Pathname.new(plugin).relative_path_from(Pathname.new(plugins_dir))}'"
end
verbose plugin_script_path
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 4ce7e92442a..5652d863316 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -821,6 +821,8 @@ def test_generate_plugins_with_build_root
assert !File.exist?(system_path), 'plugin written incorrect written to system plugins_dir'
assert File.exist?(build_root_path), 'plugin not written to build_root'
+
+ refute_includes File.read(build_root_path), build_root
end
def test_keeps_plugins_up_to_date

View File

@ -1 +1 @@
SHA512 (ruby-3.0.0.tar.xz) = 2a23c2894e62e24bb20cec6b2a016b66d7df05083668726b6f70af8338211cfec417aa3624290d1f5ccd130f65ee7b52b5db7d428abc4a9460459c9a5dd1a450
SHA512 (ruby-3.0.1.tar.xz) = 97d2e883656060846b304368d9d836e2f3ef39859c36171c9398a0573818e4ed75bfd7460f901a9553f7f53518c505327a66e74f83704a881469f5ac61fe13d7