Upgrade to Ruby 3.3.7.

This commit was merged and adjusted from Fedora f41 branch commit
<50818fa902>.

Resolves: RHEL-77994
This commit is contained in:
Jun Aruga 2025-01-30 15:27:19 +01:00
parent fe6e194e44
commit c8f183e94a
6 changed files with 44 additions and 257 deletions

View File

@ -227,7 +227,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
@@ -1353,7 +1353,8 @@ def test_self_use_paths
@@ -1365,7 +1365,8 @@ def test_self_use_paths
def test_self_user_dir
parts = [@userhome, ".gem", Gem.ruby_engine]
@ -237,7 +237,7 @@ index b25068405d..e9fef4a311 100644
FileUtils.mkdir_p File.join(parts)
@@ -1429,7 +1430,7 @@ def test_self_vendor_dir
@@ -1441,7 +1442,7 @@ def test_self_vendor_dir
vendordir(File.join(@tempdir, "vendor")) do
expected =
File.join RbConfig::CONFIG["vendordir"], "gems",

View File

@ -58,7 +58,7 @@ diff --git a/ruby.c b/ruby.c
index 60c57d6259..1eec16f2c8 100644
--- a/ruby.c
+++ b/ruby.c
@@ -1722,10 +1722,14 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt)
@@ -1724,10 +1724,14 @@ proc_options(long argc, char **argv, ruby_cmdline_options_t *opt, int envopt)
void Init_builtin_features(void);

View File

@ -1,6 +1,6 @@
%global major_version 3
%global minor_version 3
%global teeny_version 5
%global teeny_version 7
%global major_minor_version %{major_version}.%{minor_version}
%global ruby_version %{major_minor_version}.%{teeny_version}
@ -27,25 +27,27 @@
%global rubygems_dir %{_datadir}/rubygems
# Bundled libraries versions
%global rubygems_version 3.5.16
%global rubygems_version 3.5.22
%global rubygems_molinillo_version 0.8.0
%global rubygems_net_http_version 0.4.0
%global rubygems_net_http_version 0.4.1
%global rubygems_net_protocol_version 0.2.2
%global rubygems_optparse_version 0.4.0
%global rubygems_resolv_version 0.3.0
%global rubygems_resolv_version 0.4.0
%global rubygems_securerandom_version 0.3.1
%global rubygems_timeout_version 0.4.1
%global rubygems_tsort_version 0.2.0
%global rubygems_uri_version 0.13.0
%global rubygems_uri_version 0.13.1
# Default gems.
%global bundler_version 2.5.16
%global bundler_version 2.5.22
%global bundler_connection_pool_version 2.4.1
%global bundler_fileutils_version 1.7.2
%global bundler_net_http_persistent_version 4.0.2
%global bundler_net_http_persistent_version 4.0.4
%global bundler_pub_grub_version 0.5.0
%global bundler_securerandom_version 0.3.1
%global bundler_thor_version 1.3.0
%global bundler_tsort_version 0.2.0
%global bundler_uri_version 0.13.0
%global bundler_uri_version 0.13.1
%global abbrev_version 0.1.2
%global base64_version 0.2.0
@ -86,7 +88,7 @@
%global prettyprint_version 0.2.0
%global pstore_version 0.1.3
%global readline_version 0.0.4
%global reline_version 0.5.7
%global reline_version 0.5.10
%global resolv_version 0.3.0
%global resolv_replace_version 0.1.1
%global rinda_version 0.2.0
@ -97,7 +99,7 @@
%global singleton_version 0.2.0
%global stringio_version 3.1.1
%global strscan_version 3.0.9
%global syntax_suggest_version 2.0.0
%global syntax_suggest_version 2.0.1
%global syslog_version 0.1.2
%global tempfile_version 0.2.1
%global time_version 0.3.0
@ -116,12 +118,12 @@
%global bigdecimal_version 3.1.5
%global io_console_version 0.7.1
%global irb_version 1.13.1
%global json_version 2.7.1
%global json_version 2.7.2
%global psych_version 5.1.2
%global rdoc_version 6.6.3.1
# Bundled gems.
%global debug_version 1.9.1
%global debug_version 1.9.2
%global net_ftp_version 0.3.4
%global net_imap_version 0.4.9.1
%global net_pop_version 0.1.2
@ -133,7 +135,7 @@
%global racc_version 1.7.3
%global rake_version 13.1.0
%global rbs_version 3.4.0
%global rexml_version 3.3.6
%global rexml_version 3.3.9
%global rss_version 0.3.1
%global test_unit_version 3.6.1
%global typeprof_version 0.21.9
@ -171,7 +173,7 @@
Summary: An interpreter of object-oriented scripting language
Name: ruby
Version: %{ruby_version}%{?development_release}
Release: 8%{?dist}
Release: 9%{?dist}
# Licenses, which are likely not included in binary RPMs:
# Apache-2.0:
# benchmark/gc/redblack.rb
@ -279,15 +281,6 @@ Patch9: ruby-3.3.0-Disable-syntax-suggest-test-case.patch
# Make sure hardeding flags are correctly applied.
# https://bugs.ruby-lang.org/issues/20520
Patch12: ruby-3.4.0-Extract-hardening-CFLAGS-to-a-special-hardenflags-variable.patch
# Fix build error:
# RPM build errors:
# error: Installed (but unpackaged) file(s) found:
# /usr/bin/bundle.lock
# This would break not only Ruby itself, but allso all rubygem-packages.
# https://github.com/rubygems/rubygems/pull/7931
Patch13: rubygems-3.5.17-Avoid-another-race-condition-of-open-mode.patch
# https://github.com/rubygems/rubygems/pull/7939
Patch14: rubygems-3.5.17-Remove-the-lock-file-for-binstubs.patch
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
%{?with_rubypick:Suggests: rubypick}
@ -417,6 +410,7 @@ Provides: bundled(rubygem-net-http) = %{rubygems_net_http_version}
Provides: bundled(rubygem-net-protocol) = %{rubygems_net_protocol_version}
Provides: bundled(rubygem-optparse) = %{rubygems_optparse_version}
Provides: bundled(rubygem-resolv) = %{rubygems_resolv_version}
Provides: bundled(rubygem-securerandom) = %{rubygems_securerandom_version}
Provides: bundled(rubygem-timeout) = %{rubygems_timeout_version}
Provides: bundled(rubygem-tsort) = %{rubygems_tsort_version}
@ -589,6 +583,7 @@ Provides: bundled(rubygem-connection_pool) = %{bundler_connection_pool_version
Provides: bundled(rubygem-fileutils) = %{bundler_fileutils_version}
Provides: bundled(rubygem-net-http-persistent) = %{bundler_net_http_persistent_version}
Provides: bundled(rubygem-pub_grub) = %{bundler_pub_grub_version}
Provides: bundled(rubygem-securerandom) = %{bundler_securerandom_version}
Provides: bundled(rubygem-thor) = %{bundler_thor_version}
Provides: bundled(rubygem-uri) = %{bundler_uri_version}
BuildArch: noarch
@ -766,8 +761,6 @@ analysis result in RBS format, a standard type description format for Ruby
%patch 6 -p1
%patch 9 -p1
%patch 12 -p1
%patch 13 -p1
%patch 14 -p1
# Provide an example of usage of the tapset:
cp -a %{SOURCE3} .
@ -1031,6 +1024,15 @@ make -C %{_vpath_builddir} -s runruby TESTRUN_SCRIPT="-e \" \
exit 1 if Gem::Resolv::VERSION != '%{rubygems_resolv_version}'; \
\""
# SecureRandom.
make -C %{_vpath_builddir} -s runruby TESTRUN_SCRIPT="-e \" \
module Gem; module Random; end; end; \
require 'rubygems/vendor/securerandom/lib/securerandom'; \
puts '%%{rubygems_securerandom_version}: %{rubygems_securerandom_version}'; \
puts %Q[Gem::SecureRandom::VERSION: #{Gem::SecureRandom::VERSION}]; \
exit 1 if Gem::SecureRandom::VERSION != '%{rubygems_securerandom_version}'; \
\""
# Timeout.
make -C %{_vpath_builddir} -s runruby TESTRUN_SCRIPT="-e \" \
module Gem; end; \
@ -1097,6 +1099,15 @@ make -C %{_vpath_builddir} -s runruby TESTRUN_SCRIPT="-e \" \
exit 1 if Gem::Net::HTTP::Persistent::VERSION != '%{bundler_net_http_persistent_version}'; \
\""
# SecureRandom.
make -C %{_vpath_builddir} -s runruby TESTRUN_SCRIPT="-e \" \
module Bundler; module Random; end; end; \
require 'bundler/vendor/securerandom/lib/securerandom'; \
puts '%%{bundler_securerandom_version}: %{bundler_securerandom_version}'; \
puts %Q[Bundler::SecureRandom::VERSION: #{Bundler::SecureRandom::VERSION}]; \
exit 1 if Bundler::SecureRandom::VERSION != '%{bundler_securerandom_version}'; \
\""
# Thor.
make -C %{_vpath_builddir} -s runruby TESTRUN_SCRIPT="-e \" \
module Bundler; end; \
@ -1752,6 +1763,10 @@ make -C %{_vpath_builddir} runruby TESTRUN_SCRIPT=" \
%changelog
* Thu Jan 30 2025 Jun Aruga <jaruga@redhat.com> - 3.3.7-9
- Upgrade to Ruby 3.3.7
Resolves: RHEL-77994
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com>
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018

View File

@ -1,45 +0,0 @@
From 2daad257bee7a500e18ebe553e79487b267fb140 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@ruby-lang.org>
Date: Mon, 12 Aug 2024 20:18:34 +0900
Subject: [PATCH] Avoid another race condition of open mode
Instead, just open in CREATE and APPEND mode.
Also, move the workaround for old Solaris as fallback to retry.
---
lib/rubygems.rb | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 2b52cde0a749..c51ba69203cb 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -778,24 +778,20 @@ def self.open_file(path, flags, &block)
File.open(path, flags, &block)
end
+ MODE_TO_FLOCK = IO::RDONLY | IO::APPEND | IO::CREAT # :nodoc:
+
##
# Open a file with given flags, and protect access with flock
def self.open_file_with_flock(path, &block)
- flags = File.exist?(path) ? "r+" : "a+"
-
- File.open(path, flags) do |io|
+ File.open(path, MODE_TO_FLOCK) do |io|
begin
io.flock(File::LOCK_EX)
rescue Errno::ENOSYS, Errno::ENOTSUP
+ rescue Errno::ENOLCK # NFS
+ raise unless Thread.main == Thread.current
end
yield io
- rescue Errno::ENOLCK # NFS
- if Thread.main != Thread.current
- raise
- else
- open_file(path, flags, &block)
- end
end
end

View File

@ -1,183 +0,0 @@
From ace303c2d7bc0d98407e5e8b1ca77de07aa0eb75 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@ruby-lang.org>
Date: Tue, 13 Aug 2024 17:19:41 +0900
Subject: [PATCH 1/3] Remove the lock file for binstubs
https://github.com/rubygems/rubygems/pull/7806#issuecomment-2241662488
---
lib/rubygems.rb | 2 +-
lib/rubygems/installer.rb | 3 ++-
test/rubygems/test_gem_installer.rb | 10 ++++++++++
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index bd9f240e2091..7626ccfdf0d6 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -778,7 +778,7 @@ def self.open_file(path, flags, &block)
File.open(path, flags, &block)
end
- MODE_TO_FLOCK = IO::RDONLY | IO::APPEND | IO::CREAT # :nodoc:
+ MODE_TO_FLOCK = IO::RDONLY | IO::APPEND | IO::CREAT | IO::SHARE_DELETE | IO::BINARY # :nodoc:
##
# Open a file with given flags, and protect access with flock
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index d558c0be2bfa..8f95bab733f8 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -538,7 +538,7 @@ def generate_plugins # :nodoc:
def generate_bin_script(filename, bindir)
bin_script_path = File.join bindir, formatted_program_filename(filename)
- Gem.open_file_with_flock("#{bin_script_path}.lock") do
+ Gem.open_file_with_flock("#{bin_script_path}.lock") do |lock|
require "fileutils"
FileUtils.rm_f bin_script_path # prior install may have been --no-wrappers
@@ -546,6 +546,7 @@ def generate_bin_script(filename, bindir)
file.write app_script_text(filename)
file.chmod(options[:prog_mode] || 0o755)
end
+ File.unlink(lock.path)
end
verbose bin_script_path
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index a61d1b6fff28..2f4ff7349db4 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -1083,6 +1083,8 @@ def test_install_creates_working_binstub
end
assert_match(/ran executable/, e.message)
+
+ assert_path_not_exist(File.join(installer.bin_dir, "executable.lock"))
end
def test_conflicting_binstubs
@@ -1131,6 +1133,8 @@ def test_conflicting_binstubs
# We expect the bin stub to activate the version that actually contains
# the binstub.
assert_match("I have an executable", e.message)
+
+ assert_path_not_exist(File.join(installer.bin_dir, "executable.lock"))
end
def test_install_creates_binstub_that_understand_version
@@ -1160,6 +1164,8 @@ def test_install_creates_binstub_that_understand_version
end
assert_includes(e.message, "can't find gem a (= 3.0)")
+
+ assert_path_not_exist(File.join(installer.bin_dir, "executable.lock"))
end
def test_install_creates_binstub_that_prefers_user_installed_gem_to_default
@@ -1192,6 +1198,8 @@ def test_install_creates_binstub_that_prefers_user_installed_gem_to_default
end
assert_equal(e.message, "ran executable")
+
+ assert_path_not_exist(File.join(installer.bin_dir, "executable.lock"))
end
def test_install_creates_binstub_that_dont_trust_encoding
@@ -1222,6 +1230,8 @@ def test_install_creates_binstub_that_dont_trust_encoding
end
assert_match(/ran executable/, e.message)
+
+ assert_path_not_exist(File.join(installer.bin_dir, "executable.lock"))
end
def test_install_with_no_prior_files
From fa0700e0f52827ae05da59a331a2917a12c09b8a Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@ruby-lang.org>
Date: Thu, 15 Aug 2024 16:20:46 +0900
Subject: [PATCH 2/3] Workaround for TruffleRuby
---
lib/rubygems.rb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 7626ccfdf0d6..9d40fcc2f77a 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -778,7 +778,9 @@ def self.open_file(path, flags, &block)
File.open(path, flags, &block)
end
- MODE_TO_FLOCK = IO::RDONLY | IO::APPEND | IO::CREAT | IO::SHARE_DELETE | IO::BINARY # :nodoc:
+ mode = IO::RDONLY | IO::APPEND | IO::CREAT | IO::BINARY
+ mode |= IO::SHARE_DELETE if IO.const_defined?(:SHARE_DELETE)
+ MODE_TO_FLOCK = mode # :nodoc:
##
# Open a file with given flags, and protect access with flock
From 6548e7aa17186687d0a8b99571885f148363016d Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@ruby-lang.org>
Date: Fri, 16 Aug 2024 20:19:22 +0900
Subject: [PATCH 3/3] Ensure that the lock file will be removed
---
lib/rubygems/installer.rb | 3 ++-
test/rubygems/test_gem_installer.rb | 27 +++++++++++++++++++++++++++
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 8f95bab733f8..1085f73fca53 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -546,7 +546,8 @@ def generate_bin_script(filename, bindir)
file.write app_script_text(filename)
file.chmod(options[:prog_mode] || 0o755)
end
- File.unlink(lock.path)
+ ensure
+ FileUtils.rm_f lock.path
end
verbose bin_script_path
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index 2f4ff7349db4..ad5b1a244e80 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -1234,6 +1234,33 @@ def test_install_creates_binstub_that_dont_trust_encoding
assert_path_not_exist(File.join(installer.bin_dir, "executable.lock"))
end
+ def test_install_does_not_leave_lockfile_for_binstub
+ installer = util_setup_installer
+
+ installer.wrappers = true
+
+ File.class_eval do
+ alias_method :original_chmod, :chmod
+ define_method(:chmod) do |mode|
+ original_chmod(mode)
+ raise Gem::Ext::BuildError if path.end_with?("/executable")
+ end
+ end
+
+ assert_raise(Gem::Ext::BuildError) do
+ installer.install
+ end
+
+ assert_path_not_exist(File.join(installer.bin_dir, "executable.lock"))
+ # assert_path_not_exist(File.join(installer.bin_dir, "executable"))
+ ensure
+ File.class_eval do
+ remove_method :chmod
+ alias_method :chmod, :original_chmod
+ remove_method :original_chmod
+ end
+ end
+
def test_install_with_no_prior_files
installer = util_setup_installer

View File

@ -1 +1 @@
SHA512 (ruby-3.3.5.tar.xz) = dd5c6a7f74854e143e0ca46b9d7c0d1983fc4886f5f733cd108345dbf4b21f61ad978ad6806e05a57b7af28fd9216dd38d7145808188bbb3695a7f3a4eda3883
SHA512 (ruby-3.3.7.tar.xz) = 4082a7684c1b0d53a0ce493f79568e851d37a864f59c58b2e0c273b2659e0ca75318ddff939fdf5e9d0a3eeba1b6d8f03bf88afb49a5ffd77714f1c8a7dfdd55