From c7a78d54410309e3a3fa7fb4929eb62319003646 Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: Thu, 7 May 2020 22:25:26 +0200 Subject: [PATCH 01/13] Upgrade to Ruby 2.6.6. Resolves: rhbz#1833293 Resolves: rhbz#1827505 --- ruby-2.1.0-custom-rubygems-location.patch | 12 ++++++------ ruby-2.3.0-ruby_version.patch | 2 +- ruby.spec | 15 ++++++++++++--- sources | 2 +- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/ruby-2.1.0-custom-rubygems-location.patch b/ruby-2.1.0-custom-rubygems-location.patch index c4893da..0450658 100644 --- a/ruby-2.1.0-custom-rubygems-location.patch +++ b/ruby-2.1.0-custom-rubygems-location.patch @@ -64,18 +64,18 @@ index 79c003e..34f2382 100644 % R = {} % R["ruby_version"] = '"RUBY_LIB_VERSION"' diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb -index b47b6e1..0b99408 100755 +index d8987af..1efbd33 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb -@@ -334,6 +334,7 @@ def CONFIG.[](name, mandatory = false) - sitearchlibdir = CONFIG["sitearchdir"] - vendorlibdir = CONFIG["vendorlibdir"] - vendorarchlibdir = CONFIG["vendorarchdir"] +@@ -338,6 +338,7 @@ if CONFIG["vendordir"] + vendorlibdir = CONFIG["vendorlibdir"] + vendorarchlibdir = CONFIG["vendorarchdir"] + end +rubygemsdir = CONFIG["rubygemsdir"] mandir = CONFIG["mandir", true] docdir = CONFIG["docdir", true] enable_shared = CONFIG["ENABLE_SHARED"] == 'yes' -@@ -560,7 +561,16 @@ def stub +@@ -564,7 +565,16 @@ end install?(:local, :comm, :lib) do prepare "library scripts", rubylibdir noinst = %w[*.txt *.rdoc *.gemspec] diff --git a/ruby-2.3.0-ruby_version.patch b/ruby-2.3.0-ruby_version.patch index a74fb74..2367118 100644 --- a/ruby-2.3.0-ruby_version.patch +++ b/ruby-2.3.0-ruby_version.patch @@ -171,7 +171,7 @@ diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb index d4c110e..d39c9a6 100755 --- a/tool/rbinstall.rb +++ b/tool/rbinstall.rb -@@ -424,7 +424,7 @@ def CONFIG.[](name, mandatory = false) +@@ -428,7 +428,7 @@ def CONFIG.[](name, mandatory = false) install?(:doc, :rdoc) do if $rdocdir diff --git a/ruby.spec b/ruby.spec index c7b6006..d344471 100644 --- a/ruby.spec +++ b/ruby.spec @@ -1,6 +1,6 @@ %global major_version 2 %global minor_version 6 -%global teeny_version 5 +%global teeny_version 6 %global major_minor_version %{major_version}.%{minor_version} %global ruby_version %{major_minor_version}.%{teeny_version} @@ -21,7 +21,7 @@ %endif -%global release 124 +%global release 125 %{!?release_string:%global release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}} # The RubyGems library has to stay out of Ruby directory tree, since the @@ -48,7 +48,7 @@ %global openssl_version 2.1.2 %global power_assert_version 1.1.3 %global psych_version 3.1.0 -%global rake_version 12.3.2 +%global rake_version 12.3.3 %global rdoc_version 6.1.2 %global test_unit_version 3.2.9 %global xmlrpc_version 0.3.0 @@ -829,6 +829,10 @@ DISABLE_TESTS="$DISABLE_TESTS -n !/test_segv_\(setproctitle\|test\|loaded_featur # which fails on Koji. # https://bugs.ruby-lang.org/issues/14175 sed -i '/def test_mdns_each_address$/,/^ end$/ s/^/#/' test/resolv/test_mdns.rb +# Disable Timeouting test_queue_with_trap +# https://github.com/ruby/ruby/pull/3101/ +sed -i '/^ def test_queue_with_trap$/,/^ end$/ s/^/#/g' \ + test/ruby/test_thread_queue.rb make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS" @@ -1175,6 +1179,11 @@ make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS" %{_mandir}/man5/gemfile.5* %changelog +* Thu May 07 2020 Pavel Valena - 2.6.6-125 +- Upgrade to Ruby 2.6.6. + Resolves: rhbz#1833293 + Resolves: rhbz#1827505 + * Tue Oct 08 2019 Slava Kardakov - 2.6.5-124 - Update to Ruby 2.6.5. diff --git a/sources b/sources index c788916..e2d3668 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ruby-2.6.5.tar.xz) = e8ae3b5d4d23a93d0ef6057235ad0e573665a8b4b6544e1c70b4cce9c4d2fb9094e5c8fe8a9ab7b9996efe3ada603f9b4ef1fd08fb5a83253c1ae2b5e3f202db +SHA512 (ruby-2.6.6.tar.xz) = 86caf93dbf61d03781767ab5375a7edf4761f13ba08ccfefe16c0a7550499237e7390c2f72a95d42670d4fe76b2401b4218936187c62ec1572799e9e04c50d62 From 4851ffaf1040965a97247b71b1fcec81b59d588b Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: Tue, 12 May 2020 03:23:02 +0200 Subject: [PATCH 02/13] Disable "File.utime allows Time instances in the far future to set mtime and atime". https://bugs.ruby-lang.org/issues/16410 --- ruby.spec | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ruby.spec b/ruby.spec index d344471..c0c880d 100644 --- a/ruby.spec +++ b/ruby.spec @@ -833,6 +833,10 @@ sed -i '/def test_mdns_each_address$/,/^ end$/ s/^/#/' test/resolv/test_mdns.rb # https://github.com/ruby/ruby/pull/3101/ sed -i '/^ def test_queue_with_trap$/,/^ end$/ s/^/#/g' \ test/ruby/test_thread_queue.rb +# Disable "File.utime allows Time instances in the far future to set +# mtime and atime". +# https://bugs.ruby-lang.org/issues/16410 +MSPECOPTS="$MSPECOPTS -P 'File.utime allows Time instances in the far future to set mtime and atime'" make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS" From 6bd343401a7a9022013f26c2f80e14fd3ab1af90 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Thu, 6 Aug 2020 13:32:30 +0200 Subject: [PATCH 03/13] Fix FTBFS due to libyaml 0.2.5. Resolves: rhbz#1845530 --- ruby-2.7.2-psych-fix-yaml-tests.patch | 162 ++++++++++++++++++++++++++ ruby.spec | 9 +- 2 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 ruby-2.7.2-psych-fix-yaml-tests.patch diff --git a/ruby-2.7.2-psych-fix-yaml-tests.patch b/ruby-2.7.2-psych-fix-yaml-tests.patch new file mode 100644 index 0000000..5a4be77 --- /dev/null +++ b/ruby-2.7.2-psych-fix-yaml-tests.patch @@ -0,0 +1,162 @@ +From 3c55d93cf68b1a969b90b306de4dd8b88d74a2f2 Mon Sep 17 00:00:00 2001 +From: nagachika +Date: Sat, 13 Jun 2020 11:29:51 +0900 +Subject: [PATCH] merge revision(s) 7e289cdf3fed588b2d5a6973e29f9ff95cb8d76c: + [Backport #16949] + + [ruby/psych] Fixing compatibility with libyaml 0.2.5 + + The main issue is that commas aren't allowed in local tags. libyaml + was updated to follow the spec, and our tests were out of date. + + See: https://github.com/yaml/libyaml/issues/196 + + https://github.com/ruby/psych/commit/3f5e520fd3 +--- + test/psych/test_nil.rb | 4 ++-- + test/psych/test_psych.rb | 17 +++++++---------- + test/psych/test_yaml.rb | 24 ++++++++++++------------ + version.h | 4 ++-- + 4 files changed, 23 insertions(+), 26 deletions(-) + +diff --git a/test/psych/test_nil.rb b/test/psych/test_nil.rb +index 910a2e697def..bcbbcb9c9397 100644 +--- a/test/psych/test_nil.rb ++++ b/test/psych/test_nil.rb +@@ -5,13 +5,13 @@ module Psych + class TestNil < TestCase + def test_nil + yml = Psych.dump nil +- assert_match(/--- \n(?:\.\.\.\n)?/, yml) ++ assert_match(/---[ ]?\n(?:\.\.\.\n)?/, yml) + assert_nil Psych.load(yml) + end + + def test_array_nil + yml = Psych.dump [nil] +- assert_equal "---\n- \n", yml ++ assert_match(/---\n-[ ]?\n/, yml) + assert_equal [nil], Psych.load(yml) + end + +diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb +index eeadc864ef4e..e557feffb76a 100644 +--- a/test/psych/test_psych.rb ++++ b/test/psych/test_psych.rb +@@ -178,17 +178,17 @@ def test_add_builtin_type + + def test_domain_types + got = nil +- Psych.add_domain_type 'foo.bar,2002', 'foo' do |type, val| ++ Psych.add_domain_type 'foo.bar/2002', 'foo' do |type, val| + got = val + end + +- Psych.load('--- !foo.bar,2002/foo hello') ++ Psych.load('--- !foo.bar/2002:foo hello') + assert_equal 'hello', got + +- Psych.load("--- !foo.bar,2002/foo\n- hello\n- world") ++ Psych.load("--- !foo.bar/2002:foo\n- hello\n- world") + assert_equal %w{ hello world }, got + +- Psych.load("--- !foo.bar,2002/foo\nhello: world") ++ Psych.load("--- !foo.bar/2002:foo\nhello: world") + assert_equal({ 'hello' => 'world' }, got) + end + +@@ -295,16 +295,13 @@ def test_callbacks + types = [] + appender = lambda { |*args| types << args } + +- Psych.add_builtin_type('foo', &appender) +- Psych.add_domain_type('example.com,2002', 'foo', &appender) ++ Psych.add_domain_type('example.com:2002', 'foo', &appender) + Psych.load <<-eoyml +-- !tag:yaml.org,2002:foo bar +-- !tag:example.com,2002:foo bar ++- !tag:example.com:2002:foo bar + eoyml + + assert_equal [ +- ["tag:yaml.org,2002:foo", "bar"], +- ["tag:example.com,2002:foo", "bar"] ++ ["tag:example.com:2002:foo", "bar"] + ], types + end + +diff --git a/test/psych/test_yaml.rb b/test/psych/test_yaml.rb +index 5fa759c981b2..0dfd60f89434 100644 +--- a/test/psych/test_yaml.rb ++++ b/test/psych/test_yaml.rb +@@ -617,11 +617,11 @@ def test_spec_domain_prefix + raise ArgumentError, "Not a Hash in domain.tld,2002/invoice: " + val.inspect + end + } +- Psych.add_domain_type( "domain.tld,2002", 'invoice', &customer_proc ) +- Psych.add_domain_type( "domain.tld,2002", 'customer', &customer_proc ) ++ Psych.add_domain_type( "domain.tld/2002", 'invoice', &customer_proc ) ++ Psych.add_domain_type( "domain.tld/2002", 'customer', &customer_proc ) + assert_parse_only( { "invoice"=> { "customers"=> [ { "given"=>"Chris", "type"=>"domain customer", "family"=>"Dumars" } ], "type"=>"domain invoice" } }, <7, "center"=>{"x"=>73, "y"=>129}, "TYPE"=>"Shape: graph/circle"}, {"finish"=>{"x"=>89, "y"=>102}, "TYPE"=>"Shape: graph/line", "start"=>{"x"=>73, "y"=>129}}, {"TYPE"=>"Shape: graph/text", "value"=>"Pretty vector drawing.", "start"=>{"x"=>73, "y"=>129}, "color"=>16772795}, "Shape Container"]], < - 2.6.6-126 +- Fix FTBFS due to libyaml 0.2.5. + * Thu May 07 2020 Pavel Valena - 2.6.6-125 - Upgrade to Ruby 2.6.6. Resolves: rhbz#1833293 From da7e649e799e4d3cce360678d1784923f2f11906 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Thu, 6 Aug 2020 13:52:33 +0200 Subject: [PATCH 04/13] Disable LTO, which appear to cause issues with SIGSEV handler. --- ruby.spec | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ruby.spec b/ruby.spec index 2b24ef6..e2502e5 100644 --- a/ruby.spec +++ b/ruby.spec @@ -75,6 +75,10 @@ %bcond_without hardening_test %endif +# LTO appears to cause some issue to SEGV handler. +# https://bugs.ruby-lang.org/issues/17052 +%define _lto_cflags %{nil} + Summary: An interpreter of object-oriented scripting language Name: ruby Version: %{ruby_version} @@ -1189,6 +1193,7 @@ make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS" %changelog * Thu Aug 06 2020 Jun Aruga - 2.6.6-126 - Fix FTBFS due to libyaml 0.2.5. +- Disable LTO, which appear to cause issues with SIGSEV handler. * Thu May 07 2020 Pavel Valena - 2.6.6-125 - Upgrade to Ruby 2.6.6. From 7b6c9c5f131e3be599d10f17d5d6ffaa23d46f8f Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Thu, 6 Aug 2020 13:54:28 +0200 Subject: [PATCH 05/13] Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add. --- ..._bug_reporter_add-witout-raising-err.patch | 34 +++++++++++++++++++ ruby.spec | 6 +++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch diff --git a/ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch b/ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch new file mode 100644 index 0000000..81384ba --- /dev/null +++ b/ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch @@ -0,0 +1,34 @@ +From 9b42fce32bff25e0569581f76f532b9d57865aef Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?V=C3=ADt=20Ondruch?= +Date: Mon, 27 Jul 2020 14:56:05 +0200 +Subject: [PATCH] Timeout the test_bug_reporter_add witout raising error. + +While timeouting the threads might be still good idea, it does not seems +the timeout impacts the TestBugReporter#test_bug_reporter_add result, +because the output of the child process has been already collected +earlier. + +It seems that when the system is under heavy load, the thread might not +be sheduled to finish its processing. Even finishing the child process +might take tens of seconds and therefore the test case finish might take +a while. +--- + test/-ext-/bug_reporter/test_bug_reporter.rb | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/test/-ext-/bug_reporter/test_bug_reporter.rb b/test/-ext-/bug_reporter/test_bug_reporter.rb +index 628fcd0340..2c677cc8a7 100644 +--- a/test/-ext-/bug_reporter/test_bug_reporter.rb ++++ b/test/-ext-/bug_reporter/test_bug_reporter.rb +@@ -19,7 +19,7 @@ def test_bug_reporter_add + args = ["--disable-gems", "-r-test-/bug_reporter", + "-C", tmpdir] + stdin = "register_sample_bug_reporter(12345); Process.kill :SEGV, $$" +- assert_in_out_err(args, stdin, [], expected_stderr, encoding: "ASCII-8BIT") ++ assert_in_out_err(args, stdin, [], expected_stderr, encoding: "ASCII-8BIT", timeout_error: nil) + ensure + FileUtils.rm_rf(tmpdir) if tmpdir + end +-- +2.27.0 + diff --git a/ruby.spec b/ruby.spec index e2502e5..ffd3a17 100644 --- a/ruby.spec +++ b/ruby.spec @@ -150,7 +150,9 @@ Patch12: rubygems-3.0.3-Avoid-rdoc-hook-when-its-failed-to-load-rdoc-library.pat # Fix compatibility with libyaml 0.2.5 # https://bugs.ruby-lang.org/issues/16949 Patch14: ruby-2.7.2-psych-fix-yaml-tests.patch - +# Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add. +# https://bugs.ruby-lang.org/issues/16492 +Patch19: ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch # Add support for .include directive used by OpenSSL config files. # https://github.com/ruby/openssl/pull/216 Patch22: ruby-2.6.0-config-support-include-directive.patch @@ -546,6 +548,7 @@ rm -rf ext/fiddle/libffi* %patch11 -p1 %patch12 -p1 %patch14 -p1 +%patch19 -p1 %patch22 -p1 # Provide an example of usage of the tapset: @@ -1194,6 +1197,7 @@ make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS" * Thu Aug 06 2020 Jun Aruga - 2.6.6-126 - Fix FTBFS due to libyaml 0.2.5. - Disable LTO, which appear to cause issues with SIGSEV handler. +- Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add. * Thu May 07 2020 Pavel Valena - 2.6.6-125 - Upgrade to Ruby 2.6.6. From a4dab688e73d7e5bac715960e5aaf298a9a044ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Wed, 1 Apr 2020 19:08:27 +0200 Subject: [PATCH 06/13] Fix FTBFS due to glibc 2.31.9000 implementing lchmod(2). --- ...-the-fact-that-lchmod-can-EOPNOTSUPP.patch | 91 ++++++++++++ ...0-Moved-not-implemented-method-tests.patch | 134 ++++++++++++++++++ ruby.spec | 13 ++ 3 files changed, 238 insertions(+) create mode 100644 ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch create mode 100644 ruby-2.8.0-Moved-not-implemented-method-tests.patch diff --git a/ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch b/ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch new file mode 100644 index 0000000..682bd73 --- /dev/null +++ b/ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch @@ -0,0 +1,91 @@ +From 1b7c0ee13fc28a387981ae3086b40620f49831dd Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=E5=8D=9C=E9=83=A8=E6=98=8C=E5=B9=B3?= + +Date: Thu, 23 Jan 2020 15:33:42 +0900 +Subject: [PATCH 1/2] brace the fact that lchmod(2) can EOPNOTSUPP + +Musl libc has this function as a tiny wrapper of fchmodat(3posix). On +the other hand Linux kernel does not support changing modes of a symlink. +The operation always fails with EOPNOTSUPP. This fchmodat behaviour is +defined in POSIX. We have to take care of such exceptions. +--- + lib/fileutils.rb | 3 ++- + test/pathname/test_pathname.rb | 2 +- + test/ruby/test_notimp.rb | 19 ++++++++++++------- + 3 files changed, 15 insertions(+), 9 deletions(-) + +diff --git a/lib/fileutils.rb b/lib/fileutils.rb +index 8981ef98e8..6332fcd6f1 100644 +--- a/lib/fileutils.rb ++++ b/lib/fileutils.rb +@@ -1320,6 +1320,7 @@ def chmod(mode) + else + File.chmod mode, path() + end ++ rescue Errno::EOPNOTSUPP + end + + def chown(uid, gid) +@@ -1411,7 +1412,7 @@ def copy_metadata(path) + if st.symlink? + begin + File.lchmod mode, path +- rescue NotImplementedError ++ rescue NotImplementedError, Errno::EOPNOTSUPP + end + else + File.chmod mode, path +diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb +index f8e4937802..750fabf039 100644 +--- a/test/pathname/test_pathname.rb ++++ b/test/pathname/test_pathname.rb +@@ -824,7 +824,7 @@ def test_lchmod + old = path.lstat.mode + begin + path.lchmod(0444) +- rescue NotImplementedError ++ rescue NotImplementedError, Errno::EOPNOTSUPP + next + end + assert_equal(0444, path.lstat.mode & 0777) +diff --git a/test/ruby/test_notimp.rb b/test/ruby/test_notimp.rb +index ddebb657bf..daa5a82d7b 100644 +--- a/test/ruby/test_notimp.rb ++++ b/test/ruby/test_notimp.rb +@@ -13,11 +13,11 @@ def test_respond_to_fork + + def test_respond_to_lchmod + assert_include(File.methods, :lchmod) +- if /linux/ =~ RUBY_PLATFORM +- assert_equal(false, File.respond_to?(:lchmod)) +- end +- if /freebsd/ =~ RUBY_PLATFORM ++ case RUBY_PLATFORM ++ when /freebsd/, /linux-musl/ + assert_equal(true, File.respond_to?(:lchmod)) ++ when /linux/ ++ assert_equal(false, File.respond_to?(:lchmod)) + end + end + +@@ -57,9 +57,14 @@ def test_call_lchmod + File.open(f, "w") {} + File.symlink f, g + newmode = 0444 +- File.lchmod newmode, "#{d}/g" +- snew = File.lstat(g) +- assert_equal(newmode, snew.mode & 0777) ++ begin ++ File.lchmod newmode, "#{d}/g" ++ rescue Errno::EOPNOTSUPP ++ skip $! ++ else ++ snew = File.lstat(g) ++ assert_equal(newmode, snew.mode & 0777) ++ end + } + end + end +-- +2.26.2 + diff --git a/ruby-2.8.0-Moved-not-implemented-method-tests.patch b/ruby-2.8.0-Moved-not-implemented-method-tests.patch new file mode 100644 index 0000000..7272f92 --- /dev/null +++ b/ruby-2.8.0-Moved-not-implemented-method-tests.patch @@ -0,0 +1,134 @@ +From 5400fc3c67446e2f7f35ea317c596e71f0cb1ca4 Mon Sep 17 00:00:00 2001 +From: Nobuyoshi Nakada +Date: Fri, 28 Feb 2020 21:15:37 +0900 +Subject: [PATCH 2/2] Moved not-implemented method tests [Bug #16662] + +Test not-implemented method with the dedicated methods, instead of +platform dependent features. +--- + test/-ext-/test_notimplement.rb | 7 +++ + test/ruby/test_notimp.rb | 90 --------------------------------- + 2 files changed, 7 insertions(+), 90 deletions(-) + delete mode 100644 test/ruby/test_notimp.rb + +diff --git a/test/-ext-/test_notimplement.rb b/test/-ext-/test_notimplement.rb +index 92a2fd22b8..038b507b73 100644 +--- a/test/-ext-/test_notimplement.rb ++++ b/test/-ext-/test_notimplement.rb +@@ -13,10 +13,17 @@ def test_funcall_notimplement + end + + def test_respond_to ++ assert_include(Bug.methods(false), :notimplement) ++ assert_include(Bug::NotImplement.instance_methods(false), :notimplement) + assert_not_respond_to(Bug, :notimplement) + assert_not_respond_to(Bug::NotImplement.new, :notimplement) + end + ++ def test_method_inspect_notimplement ++ assert_match(/not-implemented/, Bug.method(:notimplement).inspect) ++ assert_match(/not-implemented/, Bug::NotImplement.instance_method(:notimplement).inspect) ++ end ++ + def test_not_method_defined + assert !Bug::NotImplement.method_defined?(:notimplement) + assert !Bug::NotImplement.method_defined?(:notimplement, true) +diff --git a/test/ruby/test_notimp.rb b/test/ruby/test_notimp.rb +deleted file mode 100644 +index daa5a82d7b..0000000000 +--- a/test/ruby/test_notimp.rb ++++ /dev/null +@@ -1,90 +0,0 @@ +-# frozen_string_literal: false +-require 'test/unit' +-require 'timeout' +-require 'tmpdir' +- +-class TestNotImplement < Test::Unit::TestCase +- def test_respond_to_fork +- assert_include(Process.methods, :fork) +- if /linux/ =~ RUBY_PLATFORM +- assert_equal(true, Process.respond_to?(:fork)) +- end +- end +- +- def test_respond_to_lchmod +- assert_include(File.methods, :lchmod) +- case RUBY_PLATFORM +- when /freebsd/, /linux-musl/ +- assert_equal(true, File.respond_to?(:lchmod)) +- when /linux/ +- assert_equal(false, File.respond_to?(:lchmod)) +- end +- end +- +- def test_call_fork +- GC.start +- pid = nil +- ps = +- case RUBY_PLATFORM +- when /linux/ # assume Linux Distribution uses procps +- proc {`ps -eLf #{pid}`} +- when /freebsd/ +- proc {`ps -lH #{pid}`} +- when /darwin/ +- proc {`ps -lM #{pid}`} +- else +- proc {`ps -l #{pid}`} +- end +- assert_nothing_raised(Timeout::Error, ps) do +- Timeout.timeout(EnvUtil.apply_timeout_scale(5)) { +- pid = fork {} +- Process.wait pid +- pid = nil +- } +- end +- ensure +- if pid +- Process.kill(:KILL, pid) +- Process.wait pid +- end +- end if Process.respond_to?(:fork) +- +- def test_call_lchmod +- if File.respond_to?(:lchmod) +- Dir.mktmpdir {|d| +- f = "#{d}/f" +- g = "#{d}/g" +- File.open(f, "w") {} +- File.symlink f, g +- newmode = 0444 +- begin +- File.lchmod newmode, "#{d}/g" +- rescue Errno::EOPNOTSUPP +- skip $! +- else +- snew = File.lstat(g) +- assert_equal(newmode, snew.mode & 0777) +- end +- } +- end +- end +- +- def test_method_inspect_fork +- m = Process.method(:fork) +- if Process.respond_to?(:fork) +- assert_not_match(/not-implemented/, m.inspect) +- else +- assert_match(/not-implemented/, m.inspect) +- end +- end +- +- def test_method_inspect_lchmod +- m = File.method(:lchmod) +- if File.respond_to?(:lchmod) +- assert_not_match(/not-implemented/, m.inspect) +- else +- assert_match(/not-implemented/, m.inspect) +- end +- end +- +-end +-- +2.26.2 + diff --git a/ruby.spec b/ruby.spec index ffd3a17..aacac13 100644 --- a/ruby.spec +++ b/ruby.spec @@ -156,6 +156,11 @@ Patch19: ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch # Add support for .include directive used by OpenSSL config files. # https://github.com/ruby/openssl/pull/216 Patch22: ruby-2.6.0-config-support-include-directive.patch +# Fix lchmod test failures. +# https://github.com/ruby/ruby/commit/a19228f878d955eaf2cce086bcf53f46fdf894b9 +Patch41: ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch +# https://github.com/ruby/ruby/commit/72c02aa4b79731c7f25c9267f74b347f1946c704 +Patch42: ruby-2.8.0-Moved-not-implemented-method-tests.patch Requires: %{name}-libs%{?_isa} = %{version}-%{release} Suggests: rubypick @@ -550,6 +555,8 @@ rm -rf ext/fiddle/libffi* %patch14 -p1 %patch19 -p1 %patch22 -p1 +%patch41 -p1 +%patch42 -p1 # Provide an example of usage of the tapset: cp -a %{SOURCE3} . @@ -849,6 +856,11 @@ sed -i '/^ def test_queue_with_trap$/,/^ end$/ s/^/#/g' \ # https://bugs.ruby-lang.org/issues/16410 MSPECOPTS="$MSPECOPTS -P 'File.utime allows Time instances in the far future to set mtime and atime'" +# Disable File.lchmod specs, which fails when building against glibc 2.31.9000. +# https://bugs.ruby-lang.org/issues/16749 +MSPECOPTS="$MSPECOPTS -P 'File.lchmod returns false from \#respond_to?'" +MSPECOPTS="$MSPECOPTS -P 'File.lchmod raises a NotImplementedError when called'" + make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS" %files @@ -1198,6 +1210,7 @@ make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS" - Fix FTBFS due to libyaml 0.2.5. - Disable LTO, which appear to cause issues with SIGSEV handler. - Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add. +- Fix FTBFS due to glibc 2.31.9000 implementing lchmod(2). * Thu May 07 2020 Pavel Valena - 2.6.6-125 - Upgrade to Ruby 2.6.6. From fd1c2abaf188698ab4e9722c8e2189a44a0c06a5 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Thu, 28 May 2020 17:31:05 +0200 Subject: [PATCH 07/13] Give an option to increase the timeout in tests. Because setting the option makes some tests stable that are currently randomly failing with error on especially s390x and aarch64. We observed the failing tests are calling `assert_in_out_err` method calling `invoke_ruby` calling method. Then when the `th_stdout.join(timeout)` or `th_stderr.join(timeout)` returns `nil` as thread timeout in `invoke_ruby` method, it causes the error. [1][2] The `test_timeout_scale` macro is to set the environment variable `RUBY_TEST_TIMEOUT_SCALE` to increase the timeout in `apply_timeout_scale` method as = * . As an example, `TestBugReporter#test_bug_reporter_add` test's maximum thread timeout was 56+ seconds for the default timeout 10 seconds. [3] In this case setting `RUBY_TEST_TIMEOUT_SCALE=6` (6 * 10 = 60) is good enough for 56+ seconds. [1] https://github.com/ruby/ruby/blob/v2_7_1/tool/lib/envutil.rb#L149 [2] https://bugs.ruby-lang.org/issues/16492#note-8 [3] https://bugs.ruby-lang.org/issues/16492#note-4 --- ruby.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ruby.spec b/ruby.spec index aacac13..30b43f9 100644 --- a/ruby.spec +++ b/ruby.spec @@ -861,7 +861,10 @@ MSPECOPTS="$MSPECOPTS -P 'File.utime allows Time instances in the far future to MSPECOPTS="$MSPECOPTS -P 'File.lchmod returns false from \#respond_to?'" MSPECOPTS="$MSPECOPTS -P 'File.lchmod raises a NotImplementedError when called'" -make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS" +# Give an option to increase the timeout in tests. +# https://bugs.ruby-lang.org/issues/16921 +%{?test_timeout_scale:RUBY_TEST_TIMEOUT_SCALE="%{test_timeout_scale}"} \ + make check TESTS="-v $DISABLE_TESTS" MSPECOPT="-fs $MSPECOPTS" %files %license BSDL From d7f560cf43fbff12525b4c1b0b30c6820de6a309 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Wed, 5 May 2021 13:30:43 +0200 Subject: [PATCH 08/13] Fix FTBFS due to an incompatible load. The FTBFS has started to happen with rpm-4.16.90-0.git15395.2.fc35. root.log ``` DEBUG util.py:444: error: line 116: Unknown tag: /chroot_tmpdir/srpm_unpacked/SOURCES/macros.ruby ``` As the `%{?load:...}` is undocumented, it is gone. https://github.com/rpm-software-management/rpm/issues/1669 --- ruby.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ruby.spec b/ruby.spec index 30b43f9..668f30f 100644 --- a/ruby.spec +++ b/ruby.spec @@ -21,7 +21,7 @@ %endif -%global release 126 +%global release 127 %{!?release_string:%global release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}} # The RubyGems library has to stay out of Ruby directory tree, since the @@ -109,8 +109,8 @@ Source14: test_systemtap.rb # The load directive is supported since RPM 4.12, i.e. F21+. The build process # fails on older Fedoras. -%{?load:%{SOURCE4}} -%{?load:%{SOURCE5}} +%{load:%{SOURCE4}} +%{load:%{SOURCE5}} # Fix ruby_version abuse. # https://bugs.ruby-lang.org/issues/11002 @@ -1209,6 +1209,9 @@ MSPECOPTS="$MSPECOPTS -P 'File.lchmod raises a NotImplementedError when called'" %{_mandir}/man5/gemfile.5* %changelog +* Wed Jul 07 2021 Jun Aruga - 2.6.6-127 +- Fix FTBFS due to incompatible load directive. + * Thu Aug 06 2020 Jun Aruga - 2.6.6-126 - Fix FTBFS due to libyaml 0.2.5. - Disable LTO, which appear to cause issues with SIGSEV handler. From 052fac6e36586ce5f876f942274cc5ffe9f5058a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ondruch?= Date: Wed, 3 Mar 2021 11:25:14 +0100 Subject: [PATCH 09/13] Properly support DWARF5 debug information. Resolves: rhbz#1920533 --- ruby-dwarf5-avoid_crash-r1.patch | 217 +++++++++++++++++++++++++++++++ ruby.spec | 7 + 2 files changed, 224 insertions(+) create mode 100644 ruby-dwarf5-avoid_crash-r1.patch diff --git a/ruby-dwarf5-avoid_crash-r1.patch b/ruby-dwarf5-avoid_crash-r1.patch new file mode 100644 index 0000000..6288d28 --- /dev/null +++ b/ruby-dwarf5-avoid_crash-r1.patch @@ -0,0 +1,217 @@ +--- a/addr2line.c ++++ b/addr2line.c +@@ -161,11 +161,12 @@ + struct dwarf_section debug_info; + struct dwarf_section debug_line; + struct dwarf_section debug_ranges; ++ struct dwarf_section debug_rnglists; + struct dwarf_section debug_str; + struct obj_info *next; + } obj_info_t; + +-#define DWARF_SECTION_COUNT 5 ++#define DWARF_SECTION_COUNT 6 + + static struct dwarf_section * + obj_dwarf_section_at(obj_info_t *obj, int n) +@@ -175,6 +176,7 @@ + &obj->debug_info, + &obj->debug_line, + &obj->debug_ranges, ++ &obj->debug_rnglists, + &obj->debug_str + }; + if (n < 0 || DWARF_SECTION_COUNT <= n) { +@@ -413,7 +415,7 @@ + FILL_LINE(); + break; + case DW_LNS_advance_pc: +- a = uleb128((char **)&p); ++ a = uleb128((char **)&p) * header.minimum_instruction_length; + addr += a; + break; + case DW_LNS_advance_line: { +@@ -452,7 +454,7 @@ + /* isa = (unsigned int)*/(void)uleb128((char **)&p); + break; + case 0: +- a = *(unsigned char *)p++; ++ a = uleb128((char **)&p); + op = *p++; + switch (op) { + case DW_LNE_end_sequence: +@@ -766,6 +768,18 @@ + DW_FORM_addrx4 = 0x2c + }; + ++/* Range list entry encodings */ ++enum { ++ DW_RLE_end_of_list = 0x00, ++ DW_RLE_base_addressx = 0x01, ++ DW_RLE_startx_endx = 0x02, ++ DW_RLE_startx_length = 0x03, ++ DW_RLE_offset_pair = 0x04, ++ DW_RLE_base_address = 0x05, ++ DW_RLE_start_end = 0x06, ++ DW_RLE_start_length = 0x07 ++}; ++ + enum { + VAL_none = 0, + VAL_cstr = 1, +@@ -919,6 +933,23 @@ + } + + static void ++di_skip_die_attributes(char **p) ++{ ++ for (;;) { ++ uint64_t at = uleb128(p); ++ uint64_t form = uleb128(p); ++ if (!at && !form) break; ++ switch (form) { ++ default: ++ break; ++ case DW_FORM_implicit_const: ++ sleb128(p); ++ break; ++ } ++ } ++} ++ ++static void + di_read_debug_abbrev_cu(DebugInfoReader *reader) + { + uint64_t prev = 0; +@@ -932,12 +963,7 @@ + prev = abbrev_number; + uleb128(&p); /* tag */ + p++; /* has_children */ +- /* skip content */ +- for (;;) { +- uint64_t at = uleb128(&p); +- uint64_t form = uleb128(&p); +- if (!at && !form) break; +- } ++ di_skip_die_attributes(&p); + } + } + +@@ -1202,12 +1228,7 @@ + /* skip 255th record */ + uleb128(&p); /* tag */ + p++; /* has_children */ +- /* skip content */ +- for (;;) { +- uint64_t at = uleb128(&p); +- uint64_t form = uleb128(&p); +- if (!at && !form) break; +- } ++ di_skip_die_attributes(&p); + for (n = uleb128(&p); abbrev_number != n; n = uleb128(&p)) { + if (n == 0) { + fprintf(stderr,"%d: Abbrev Number %"PRId64" not found\n",__LINE__, abbrev_number); +@@ -1215,12 +1236,7 @@ + } + uleb128(&p); /* tag */ + p++; /* has_children */ +- /* skip content */ +- for (;;) { +- uint64_t at = uleb128(&p); +- uint64_t form = uleb128(&p); +- if (!at && !form) break; +- } ++ di_skip_die_attributes(&p); + } + return p; + } +@@ -1348,6 +1364,21 @@ + } + } + ++static uint64_t ++read_dw_form_addr(DebugInfoReader *reader, char **ptr) ++{ ++ char *p = *ptr; ++ *ptr = p + reader->format; ++ if (reader->format == 4) { ++ return read_uint32(&p); ++ } else if (reader->format == 8) { ++ return read_uint64(&p); ++ } else { ++ fprintf(stderr,"unknown address_size:%d", reader->address_size); ++ abort(); ++ } ++} ++ + static uintptr_t + ranges_include(DebugInfoReader *reader, ranges_t *ptr, uint64_t addr) + { +@@ -1361,8 +1392,50 @@ + } + else if (ptr->ranges_set) { + /* TODO: support base address selection entry */ +- char *p = reader->obj->debug_ranges.ptr + ptr->ranges; ++ char *p; + uint64_t base = ptr->low_pc_set ? ptr->low_pc : reader->current_low_pc; ++ if (reader->obj->debug_rnglists.ptr) { ++ p = reader->obj->debug_rnglists.ptr + ptr->ranges; ++ for (;;) { ++ uint8_t rle = read_uint8(&p); ++ uintptr_t base_address = 0; ++ uintptr_t from, to; ++ if (rle == DW_RLE_end_of_list) break; ++ switch (rle) { ++ case DW_RLE_base_addressx: ++ uleb128(&p); ++ break; ++ case DW_RLE_startx_endx: ++ uleb128(&p); ++ uleb128(&p); ++ break; ++ case DW_RLE_startx_length: ++ uleb128(&p); ++ uleb128(&p); ++ break; ++ case DW_RLE_offset_pair: ++ from = base_address + uleb128(&p); ++ to = base_address + uleb128(&p); ++ if (base + from <= addr && addr < base + to) { ++ return from; ++ } ++ break; ++ case DW_RLE_base_address: ++ base_address = read_dw_form_addr(reader, &p); ++ break; ++ case DW_RLE_start_end: ++ read_dw_form_addr(reader, &p); ++ read_dw_form_addr(reader, &p); ++ break; ++ case DW_RLE_start_length: ++ read_dw_form_addr(reader, &p); ++ uleb128(&p); ++ break; ++ } ++ } ++ return false; ++ } ++ p = reader->obj->debug_ranges.ptr + ptr->ranges; + for (;;) { + uintptr_t from = read_uintptr(&p); + uintptr_t to = read_uintptr(&p); +@@ -1702,6 +1775,7 @@ + ".debug_info", + ".debug_line", + ".debug_ranges", ++ ".debug_rnglists", + ".debug_str" + }; + +@@ -1950,6 +2024,7 @@ + "__debug_info", + "__debug_line", + "__debug_ranges", ++ "__debug_rnglists", + "__debug_str" + }; + struct LP(segment_command) *scmd = (struct LP(segment_command) *)lcmd; diff --git a/ruby.spec b/ruby.spec index 668f30f..aa542f9 100644 --- a/ruby.spec +++ b/ruby.spec @@ -150,6 +150,10 @@ Patch12: rubygems-3.0.3-Avoid-rdoc-hook-when-its-failed-to-load-rdoc-library.pat # Fix compatibility with libyaml 0.2.5 # https://bugs.ruby-lang.org/issues/16949 Patch14: ruby-2.7.2-psych-fix-yaml-tests.patch +# Fix DWARF5 support. +# https://bugzilla.redhat.com/show_bug.cgi?id=1920533 +# https://bugs.ruby-lang.org/issues/17585 +Patch15: ruby-dwarf5-avoid_crash-r1.patch # Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add. # https://bugs.ruby-lang.org/issues/16492 Patch19: ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch @@ -553,6 +557,7 @@ rm -rf ext/fiddle/libffi* %patch11 -p1 %patch12 -p1 %patch14 -p1 +%patch15 -p1 %patch19 -p1 %patch22 -p1 %patch41 -p1 @@ -1211,6 +1216,8 @@ MSPECOPTS="$MSPECOPTS -P 'File.lchmod raises a NotImplementedError when called'" %changelog * Wed Jul 07 2021 Jun Aruga - 2.6.6-127 - Fix FTBFS due to incompatible load directive. +- Properly support DWARF5 debug information. + Resolves: rhbz#1920533 * Thu Aug 06 2020 Jun Aruga - 2.6.6-126 - Fix FTBFS due to libyaml 0.2.5. From 77d7664ed7494487085c3855703c09c3445c58c6 Mon Sep 17 00:00:00 2001 From: Jun Aruga Date: Thu, 8 Jul 2021 12:45:04 +0200 Subject: [PATCH 10/13] Fix rpmlint issue. Fix the following rpmlint issue. ``` ruby.spec:609: W: macro-in-comment %{ruby_version} ``` --- ruby.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruby.spec b/ruby.spec index aa542f9..d3e9dde 100644 --- a/ruby.spec +++ b/ruby.spec @@ -606,7 +606,7 @@ make install DESTDIR=%{buildroot} # Rename ruby/config.h to ruby/config-.h to avoid file conflicts on # multilib systems and install config.h wrapper %multilib_fix_c_header --file %{_includedir}/%{name}/config.h -# TODO: The correct patch should be %%{_includedir}/%%{name}/rb_mjit_min_header-%{ruby_version}.h +# TODO: The correct patch should be %%{_includedir}/%%{name}/rb_mjit_min_header-%%{ruby_version}.h # https://bugs.ruby-lang.org/issues/15425 %multilib_fix_c_header --file %{_includedir}/rb_mjit_min_header-%{ruby_version}.h From 7996ee7339050de1a1bcd83685946fa73a4b85d2 Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: Thu, 4 Nov 2021 20:53:54 +0100 Subject: [PATCH 11/13] Sync with ruby:2.6 EL8 Appstream. --- ...-additional-preludes-by-configuratio.patch | 2 +- ...0-Enable-configuration-of-archlibdir.patch | 2 +- ...ed-paths-when-empty-version-string-i.patch | 2 +- ruby-2.1.0-always-use-i386.patch | 2 +- ruby-2.1.0-custom-rubygems-location.patch | 4 +- ...2.3-Generate-preludes-using-miniruby.patch | 2 +- ruby-2.3.0-ruby_version.patch | 6 +- ...ddle-1.0.0-ffi-closure-alloc-default.patch | 61 +++++++ ...tforms-to-wait-for-input-with-recvfr.patch | 131 +++++++++++++++ ...nvert-ip-addresses-to-canonical-form.patch | 26 +++ ruby.spec | 52 +++++- ...emporary-directory-as-home-directory.patch | 157 ++++++++++++++++++ sources | 2 +- 13 files changed, 431 insertions(+), 18 deletions(-) create mode 100644 ruby-2.6.3-fiddle-1.0.0-ffi-closure-alloc-default.patch create mode 100644 ruby-2.7.0-preview1-IO.select-on-all-platforms-to-wait-for-input-with-recvfr.patch create mode 100644 ruby-3.0.0-Convert-ip-addresses-to-canonical-form.patch create mode 100644 rubygem-bundler-2.1.0-dont-use-insecure-temporary-directory-as-home-directory.patch diff --git a/ruby-2.1.0-Allow-to-specify-additional-preludes-by-configuratio.patch b/ruby-2.1.0-Allow-to-specify-additional-preludes-by-configuratio.patch index 0770723..14da77e 100644 --- a/ruby-2.1.0-Allow-to-specify-additional-preludes-by-configuratio.patch +++ b/ruby-2.1.0-Allow-to-specify-additional-preludes-by-configuratio.patch @@ -39,7 +39,7 @@ diff --git a/configure.ac b/configure.ac index 028ef7ca3e..cdeff87871 100644 --- a/configure.ac +++ b/configure.ac -@@ -3855,6 +3855,13 @@ AC_SUBST(rubyarchhdrdir)dnl +@@ -3872,6 +3872,13 @@ AC_SUBST(rubyarchhdrdir)dnl AC_SUBST(sitearchhdrdir)dnl AC_SUBST(vendorarchhdrdir)dnl diff --git a/ruby-2.1.0-Enable-configuration-of-archlibdir.patch b/ruby-2.1.0-Enable-configuration-of-archlibdir.patch index 116bb66..d5ecc34 100644 --- a/ruby-2.1.0-Enable-configuration-of-archlibdir.patch +++ b/ruby-2.1.0-Enable-configuration-of-archlibdir.patch @@ -11,7 +11,7 @@ diff --git a/configure.ac b/configure.ac index 11fc237552..b77e88fc37 100644 --- a/configure.ac +++ b/configure.ac -@@ -3085,6 +3085,11 @@ AS_IF([test ${multiarch+set}], [ +@@ -3102,6 +3102,11 @@ AS_IF([test ${multiarch+set}], [ ]) archlibdir='${libdir}/${arch}' diff --git a/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch b/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch index bfb197f..f7f364f 100644 --- a/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch +++ b/ruby-2.1.0-Prevent-duplicated-paths-when-empty-version-string-i.patch @@ -14,7 +14,7 @@ diff --git a/configure.ac b/configure.ac index 999e2d6d5d..11fc237552 100644 --- a/configure.ac +++ b/configure.ac -@@ -3710,7 +3710,8 @@ AS_CASE(["$ruby_version_dir_name"], +@@ -3727,7 +3727,8 @@ AS_CASE(["$ruby_version_dir_name"], ruby_version_dir=/'${ruby_version_dir_name}' if test -z "${ruby_version_dir_name}"; then diff --git a/ruby-2.1.0-always-use-i386.patch b/ruby-2.1.0-always-use-i386.patch index d63752a..cde4302 100644 --- a/ruby-2.1.0-always-use-i386.patch +++ b/ruby-2.1.0-always-use-i386.patch @@ -11,7 +11,7 @@ diff --git a/configure.ac b/configure.ac index b77e88fc37..6bba453e3c 100644 --- a/configure.ac +++ b/configure.ac -@@ -3774,6 +3774,8 @@ AC_SUBST(vendorarchdir)dnl +@@ -3791,6 +3791,8 @@ AC_SUBST(vendorarchdir)dnl AC_SUBST(CONFIGURE, "`echo $0 | sed 's|.*/||'`")dnl AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl diff --git a/ruby-2.1.0-custom-rubygems-location.patch b/ruby-2.1.0-custom-rubygems-location.patch index 0450658..d9b6915 100644 --- a/ruby-2.1.0-custom-rubygems-location.patch +++ b/ruby-2.1.0-custom-rubygems-location.patch @@ -15,7 +15,7 @@ diff --git a/configure.ac b/configure.ac index 6bba453e3c..028ef7ca3e 100644 --- a/configure.ac +++ b/configure.ac -@@ -3746,6 +3746,10 @@ AC_ARG_WITH(vendorarchdir, +@@ -3763,6 +3763,10 @@ AC_ARG_WITH(vendorarchdir, [vendorarchdir=$withval], [vendorarchdir=${multiarch+'${rubysitearchprefix}/vendor_ruby'${ruby_version_dir}}${multiarch-'${vendorlibdir}/${sitearch}'}]) @@ -26,7 +26,7 @@ index 6bba453e3c..028ef7ca3e 100644 AS_IF([test "${LOAD_RELATIVE+set}"], [ AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE) RUBY_EXEC_PREFIX='' -@@ -3770,6 +3774,7 @@ AC_SUBST(sitearchdir)dnl +@@ -3787,6 +3787,7 @@ AC_SUBST(sitearchdir)dnl AC_SUBST(vendordir)dnl AC_SUBST(vendorlibdir)dnl AC_SUBST(vendorarchdir)dnl diff --git a/ruby-2.2.3-Generate-preludes-using-miniruby.patch b/ruby-2.2.3-Generate-preludes-using-miniruby.patch index 7118a32..e8107d7 100644 --- a/ruby-2.2.3-Generate-preludes-using-miniruby.patch +++ b/ruby-2.2.3-Generate-preludes-using-miniruby.patch @@ -11,7 +11,7 @@ diff --git a/common.mk b/common.mk index 168dc52..20c218a 100644 --- a/common.mk +++ b/common.mk -@@ -1052,9 +1052,9 @@ $(MINIPRELUDE_C): $(COMPILE_PRELUDE) +@@ -1053,9 +1053,9 @@ $(MINIPRELUDE_C): $(COMPILE_PRELUDE) $(srcdir)/template/prelude.c.tmpl $(PRELUDE_C): $(COMPILE_PRELUDE) \ diff --git a/ruby-2.3.0-ruby_version.patch b/ruby-2.3.0-ruby_version.patch index 2367118..e46915c 100644 --- a/ruby-2.3.0-ruby_version.patch +++ b/ruby-2.3.0-ruby_version.patch @@ -20,7 +20,7 @@ diff --git a/configure.ac b/configure.ac index 8ea969412f..a00f2b6776 100644 --- a/configure.ac +++ b/configure.ac -@@ -3661,9 +3661,6 @@ AS_CASE(["$target_os"], +@@ -3678,9 +3678,6 @@ AS_CASE(["$target_os"], rubyw_install_name='$(RUBYW_INSTALL_NAME)' ]) @@ -30,7 +30,7 @@ index 8ea969412f..a00f2b6776 100644 rubyarchprefix=${multiarch+'${archlibdir}/${RUBY_BASE_NAME}'}${multiarch-'${rubylibprefix}/${arch}'} AC_ARG_WITH(rubyarchprefix, AS_HELP_STRING([--with-rubyarchprefix=DIR], -@@ -3686,56 +3683,62 @@ AC_ARG_WITH(ridir, +@@ -3703,56 +3703,62 @@ AC_ARG_WITH(ridir, AC_SUBST(ridir) AC_SUBST(RI_BASE_NAME) @@ -120,7 +120,7 @@ index 8ea969412f..a00f2b6776 100644 AS_IF([test "${LOAD_RELATIVE+set}"], [ AC_DEFINE_UNQUOTED(LOAD_RELATIVE, $LOAD_RELATIVE) -@@ -3752,6 +3755,7 @@ AC_SUBST(sitearchincludedir)dnl +@@ -3769,6 +3769,7 @@ AC_SUBST(sitearchincludedir)dnl AC_SUBST(arch)dnl AC_SUBST(sitearch)dnl AC_SUBST(ruby_version)dnl diff --git a/ruby-2.6.3-fiddle-1.0.0-ffi-closure-alloc-default.patch b/ruby-2.6.3-fiddle-1.0.0-ffi-closure-alloc-default.patch new file mode 100644 index 0000000..c54f1e4 --- /dev/null +++ b/ruby-2.6.3-fiddle-1.0.0-ffi-closure-alloc-default.patch @@ -0,0 +1,61 @@ +diff --git a/ext/fiddle/closure.c b/ext/fiddle/closure.c +index 1a80b2b..b997e23 100644 +--- a/ext/fiddle/closure.c ++++ b/ext/fiddle/closure.c +@@ -13,25 +13,11 @@ typedef struct { + ffi_type **argv; + } fiddle_closure; + +-#if defined(USE_FFI_CLOSURE_ALLOC) +-#elif defined(__OpenBSD__) || defined(__APPLE__) || defined(__linux__) +-# define USE_FFI_CLOSURE_ALLOC 0 +-#elif defined(RUBY_LIBFFI_MODVERSION) && RUBY_LIBFFI_MODVERSION < 3000005 && \ +- (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_AMD64)) +-# define USE_FFI_CLOSURE_ALLOC 0 +-#else +-# define USE_FFI_CLOSURE_ALLOC 1 +-#endif +- + static void + dealloc(void * ptr) + { + fiddle_closure * cls = (fiddle_closure *)ptr; +-#if USE_FFI_CLOSURE_ALLOC + ffi_closure_free(cls->pcl); +-#else +- munmap(cls->pcl, sizeof(*cls->pcl)); +-#endif + if (cls->argv) xfree(cls->argv); + xfree(cls); + } +@@ -205,12 +191,7 @@ allocate(VALUE klass) + VALUE i = TypedData_Make_Struct(klass, fiddle_closure, + &closure_data_type, closure); + +-#if USE_FFI_CLOSURE_ALLOC + closure->pcl = ffi_closure_alloc(sizeof(ffi_closure), &closure->code); +-#else +- closure->pcl = mmap(NULL, sizeof(ffi_closure), PROT_READ | PROT_WRITE, +- MAP_ANON | MAP_PRIVATE, -1, 0); +-#endif + + return i; + } +@@ -257,17 +238,8 @@ initialize(int rbargc, VALUE argv[], VALUE self) + if (FFI_OK != result) + rb_raise(rb_eRuntimeError, "error prepping CIF %d", result); + +-#if USE_FFI_CLOSURE_ALLOC + result = ffi_prep_closure_loc(pcl, cif, callback, + (void *)self, cl->code); +-#else +- result = ffi_prep_closure(pcl, cif, callback, (void *)self); +- cl->code = (void *)pcl; +- i = mprotect(pcl, sizeof(*pcl), PROT_READ | PROT_EXEC); +- if (i) { +- rb_sys_fail("mprotect"); +- } +-#endif + + if (FFI_OK != result) + rb_raise(rb_eRuntimeError, "error prepping closure %d", result); diff --git a/ruby-2.7.0-preview1-IO.select-on-all-platforms-to-wait-for-input-with-recvfr.patch b/ruby-2.7.0-preview1-IO.select-on-all-platforms-to-wait-for-input-with-recvfr.patch new file mode 100644 index 0000000..f5d01ce --- /dev/null +++ b/ruby-2.7.0-preview1-IO.select-on-all-platforms-to-wait-for-input-with-recvfr.patch @@ -0,0 +1,131 @@ +From 920b924e5652884064a9529ffbd80d458a46fbc6 Mon Sep 17 00:00:00 2001 +From: eregon +Date: Tue, 5 Feb 2019 09:58:50 +0000 +Subject: [PATCH] Make sure to wait with IO.select before using + Socket#recvfrom_nonblock + +* On all platforms, as this is the recommended code pattern. + +git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e +--- + spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb b/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb +index c1239ae637e0..74fd286c42ad 100644 +--- a/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb ++++ b/spec/ruby/library/socket/socket/recvfrom_nonblock_spec.rb +@@ -36,12 +36,11 @@ + describe 'with data available' do + before do + @client.write('hello') +- +- platform_is(:darwin, :freebsd) { IO.select([@server]) } + end + + platform_is_not :windows do + it 'returns an Array containing the data and an Addrinfo' do ++ IO.select([@server]) + ret = @server.recvfrom_nonblock(1) + + ret.should be_an_instance_of(Array) +@@ -54,8 +53,7 @@ + 5.times do + @client.write('hello') + +- platform_is(:darwin, :freebsd) { IO.select([@server]) } +- ++ IO.select([@server]) + msg, _ = @server.recvfrom_nonblock(5) + + msg.should == 'hello' +@@ -66,6 +64,7 @@ + platform_is_not :windows do + describe 'the returned Array' do + before do ++ IO.select([@server]) + @array = @server.recvfrom_nonblock(1) + end + +@@ -80,6 +79,7 @@ + + describe 'the returned Addrinfo' do + before do ++ IO.select([@server]) + @addr = @server.recvfrom_nonblock(1)[1] + end + +From c1f0daeb6ac5c5414c9a4a58bb778a118006ae1f Mon Sep 17 00:00:00 2001 +From: eregon +Date: Tue, 5 Feb 2019 10:19:29 +0000 +Subject: [PATCH] Make sure to wait with IO.select before using + Socket#accept_nonblock and recvfrom_nonblock + +* On all platforms, as this is the recommended code pattern. + +git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e +--- + spec/ruby/library/socket/socket/accept_nonblock_spec.rb | 4 ++-- + spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb | 5 +++-- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/spec/ruby/library/socket/socket/accept_nonblock_spec.rb b/spec/ruby/library/socket/socket/accept_nonblock_spec.rb +index 3ef219ed05a9..cde9e6a4b669 100644 +--- a/spec/ruby/library/socket/socket/accept_nonblock_spec.rb ++++ b/spec/ruby/library/socket/socket/accept_nonblock_spec.rb +@@ -86,8 +86,6 @@ + @client = Socket.new(family, :STREAM, 0) + + @client.connect(addr) +- +- platform_is(:darwin, :freebsd, :solaris) { IO.select([@server]) } + end + + after do +@@ -96,6 +94,7 @@ + end + + it 'returns an Array containing a Socket and an Addrinfo' do ++ IO.select([@server]) + @socket, addrinfo = @server.accept_nonblock + + @socket.should be_an_instance_of(Socket) +@@ -104,6 +103,7 @@ + + describe 'the returned Addrinfo' do + before do ++ IO.select([@server]) + @socket, @addr = @server.accept_nonblock + end + +diff --git a/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb b/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb +index 015109a05200..62bbaf0dc93a 100644 +--- a/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb ++++ b/spec/ruby/library/socket/udpsocket/recvfrom_nonblock_spec.rb +@@ -40,16 +40,16 @@ + describe 'with data available' do + before do + @client.write('hello') +- +- platform_is(:darwin, :freebsd) { IO.select([@server]) } + end + + it 'returns an Array containing the data and an Array' do ++ IO.select([@server]) + @server.recvfrom_nonblock(1).should be_an_instance_of(Array) + end + + describe 'the returned Array' do + before do ++ IO.select([@server]) + @array = @server.recvfrom_nonblock(1) + end + +@@ -64,6 +64,7 @@ + + describe 'the returned address Array' do + before do ++ IO.select([@server]) + @addr = @server.recvfrom_nonblock(1)[1] + end + diff --git a/ruby-3.0.0-Convert-ip-addresses-to-canonical-form.patch b/ruby-3.0.0-Convert-ip-addresses-to-canonical-form.patch new file mode 100644 index 0000000..99b0430 --- /dev/null +++ b/ruby-3.0.0-Convert-ip-addresses-to-canonical-form.patch @@ -0,0 +1,26 @@ +From 2becb920e431110c4afc4fa069b051c5940c2096 Mon Sep 17 00:00:00 2001 +From: Jeremy Evans +Date: Fri, 29 May 2020 14:13:30 -0700 +Subject: [PATCH] Convert ip addresses to canonical form in + Resolv::DNS::Requester::UnconnectedUDP#sender + +Otherwise, if the IP address given is not in canonical form, it +won't match, and Resolv will ignore it. + +Fixes [Bug #16439] +--- + lib/resolv.rb | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/resolv.rb b/lib/resolv.rb +index e7b45e785a85..d78531e174fd 100644 +--- a/lib/resolv.rb ++++ b/lib/resolv.rb +@@ -762,6 +762,7 @@ def recv_reply(readable_socks) + end + + def sender(msg, data, host, port=Port) ++ host = Addrinfo.ip(host).ip_address + lazy_initialize + sock = @socks_hash[host.index(':') ? "::" : "0.0.0.0"] + return nil if !sock diff --git a/ruby.spec b/ruby.spec index d3e9dde..47b8e6d 100644 --- a/ruby.spec +++ b/ruby.spec @@ -1,6 +1,6 @@ %global major_version 2 %global minor_version 6 -%global teeny_version 6 +%global teeny_version 7 %global major_minor_version %{major_version}.%{minor_version} %global ruby_version %{major_minor_version}.%{teeny_version} @@ -21,7 +21,7 @@ %endif -%global release 127 +%global release 128 %{!?release_string:%global release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}} # The RubyGems library has to stay out of Ruby directory tree, since the @@ -29,7 +29,7 @@ %global rubygems_dir %{_datadir}/rubygems # Bundled libraries versions -%global rubygems_version 3.0.3 +%global rubygems_version 3.0.3.1 %global rubygems_molinillo_version 0.5.7 %global bundler_version 1.17.2 @@ -147,6 +147,7 @@ Patch11: rubygems-3.0.3-Restore-gem-build-behavior-and-introdcue-the-C-flag-to-g # This allows to loosen the RDoc dependency again. # https://github.com/rubygems/rubygems/pull/2604 Patch12: rubygems-3.0.3-Avoid-rdoc-hook-when-its-failed-to-load-rdoc-library.patch + # Fix compatibility with libyaml 0.2.5 # https://bugs.ruby-lang.org/issues/16949 Patch14: ruby-2.7.2-psych-fix-yaml-tests.patch @@ -160,6 +161,26 @@ Patch19: ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch # Add support for .include directive used by OpenSSL config files. # https://github.com/ruby/openssl/pull/216 Patch22: ruby-2.6.0-config-support-include-directive.patch + +# IO.select on all platforms to wait for input with recvfrom_nonblock +# and accept_nonblock +# https://bugzilla.redhat.com/show_bug.cgi?id=1719743 +# https://github.com/ruby/ruby/commit/920b924e5652884064a9529ffbd80d458a46fbc6 +# https://github.com/ruby/ruby/commit/c1f0daeb6ac5c5414c9a4a58bb778a118006ae1f +Patch24: ruby-2.7.0-preview1-IO.select-on-all-platforms-to-wait-for-input-with-recvfr.patch +# Use ffi_closure_alloc to avoid segmentation fault by libffi on aarch64. +# https://bugzilla.redhat.com/show_bug.cgi?id=1727832 +# https://bugzilla.redhat.com/show_bug.cgi?id=1721569 +# https://github.com/ruby/fiddle/pull/20 +Patch25: ruby-2.6.3-fiddle-1.0.0-ffi-closure-alloc-default.patch +# Resolv::DNS: timeouts if multiple IPv6 name servers are given and address +# contains leading zero +# https://bugzilla.redhat.com/show_bug.cgi?id=1944227 +Patch26: ruby-3.0.0-Convert-ip-addresses-to-canonical-form.patch +# rubygem-bundler: Insecure permissions on directory in /tmp/ allows for execution of malicious code +# https://bugzilla.redhat.com/show_bug.cgi?id=1651826 +# https://github.com/rubygems/bundler/pull/7416 +Patch27: rubygem-bundler-2.1.0-dont-use-insecure-temporary-directory-as-home-directory.patch # Fix lchmod test failures. # https://github.com/ruby/ruby/commit/a19228f878d955eaf2cce086bcf53f46fdf894b9 Patch41: ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch @@ -560,6 +581,10 @@ rm -rf ext/fiddle/libffi* %patch15 -p1 %patch19 -p1 %patch22 -p1 +%patch24 -p1 +%patch25 -p1 +%patch26 -p1 +%patch27 -p1 %patch41 -p1 %patch42 -p1 @@ -618,16 +643,22 @@ make install DESTDIR=%{buildroot} sed -i 's/Version: \${ruby_version}/Version: %{ruby_version}/' %{buildroot}%{_libdir}/pkgconfig/%{name}.pc # Kill bundled certificates, as they should be part of ca-certificates. +# bundler for cert in \ rubygems.global.ssl.fastly.net/DigiCertHighAssuranceEVRootCA.pem \ rubygems.org/AddTrustExternalCARoot.pem \ index.rubygems.org/GlobalSignRootCA.pem do - rm %{buildroot}%{rubygems_dir}/rubygems/ssl_certs/$cert - rm -r $(dirname %{buildroot}%{rubygems_dir}/rubygems/ssl_certs/$cert) rm %{buildroot}%{ruby_libdir}/bundler/ssl_certs/$cert rm -r $(dirname %{buildroot}%{ruby_libdir}/bundler/ssl_certs/$cert) done + +for cert in \ + rubygems.org/GlobalSignRootCA.pem +do + rm %{buildroot}%{rubygems_dir}/rubygems/ssl_certs/$cert + rm -r $(dirname %{buildroot}%{rubygems_dir}/rubygems/ssl_certs/$cert) +done # Ensure there is not forgotten any certificate. test ! "$(ls -A %{buildroot}%{rubygems_dir}/rubygems/ssl_certs/ 2>/dev/null)" test "$(ls -A %{buildroot}%{ruby_libdir}/bundler/ssl_certs/ 2>/dev/null)" \ @@ -1086,7 +1117,7 @@ MSPECOPTS="$MSPECOPTS -P 'File.lchmod raises a NotImplementedError when called'" %{gem_dir}/specifications/default/mutex_m-0.1.0.gemspec %{gem_dir}/specifications/default/ostruct-0.1.0.gemspec %{gem_dir}/specifications/default/prime-0.1.0.gemspec -%{gem_dir}/specifications/default/rexml-3.1.9.gemspec +%{gem_dir}/specifications/default/rexml-3.1.9.1.gemspec %{gem_dir}/specifications/default/rss-0.2.7.gemspec %{gem_dir}/specifications/default/scanf-1.0.0.gemspec %{gem_dir}/specifications/default/sdbm-1.0.0.gemspec @@ -1096,7 +1127,7 @@ MSPECOPTS="$MSPECOPTS -P 'File.lchmod raises a NotImplementedError when called'" %{gem_dir}/specifications/default/sync-0.5.0.gemspec %{gem_dir}/specifications/default/thwait-0.1.0.gemspec %{gem_dir}/specifications/default/tracer-0.1.0.gemspec -%{gem_dir}/specifications/default/webrick-1.4.2.gemspec +%{gem_dir}/specifications/default/webrick-1.4.4.gemspec %{gem_dir}/specifications/default/zlib-1.0.0.gemspec %files -n rubygems-devel @@ -1214,6 +1245,13 @@ MSPECOPTS="$MSPECOPTS -P 'File.lchmod raises a NotImplementedError when called'" %{_mandir}/man5/gemfile.5* %changelog +* Wed Apr 14 2021 Jarek Prokop - 2.6.7-128 +- Upgrade to Ruby 2.6.7. +- Resolv::DNS: timeouts if multiple IPv6 name servers are given an address + containing leading zero +- Fix: Rubygem-bundler: Don't use insecure tmp directory as home + allows for execution of malicious code. + * Wed Jul 07 2021 Jun Aruga - 2.6.6-127 - Fix FTBFS due to incompatible load directive. - Properly support DWARF5 debug information. diff --git a/rubygem-bundler-2.1.0-dont-use-insecure-temporary-directory-as-home-directory.patch b/rubygem-bundler-2.1.0-dont-use-insecure-temporary-directory-as-home-directory.patch new file mode 100644 index 0000000..948f79d --- /dev/null +++ b/rubygem-bundler-2.1.0-dont-use-insecure-temporary-directory-as-home-directory.patch @@ -0,0 +1,157 @@ +From 65cfebb041c454c246aaf32a177b0243915a9998 Mon Sep 17 00:00:00 2001 +From: fatkodima +Date: Fri, 1 Nov 2019 23:06:10 +0200 +Subject: [PATCH] Don't use insecure temporary directory as home directory + +--- + lib/bundler.rb | 29 +++++++++++--------------- + spec/bundler/bundler_spec.rb | 38 +++++++++-------------------------- + spec/bundler/settings_spec.rb | 2 +- + 3 files changed, 22 insertions(+), 47 deletions(-) + +diff --git a/lib/bundler.rb b/lib/bundler.rb +index 2ada6fe7891..b184f7e69c6 100644 +--- a/lib/bundler.rb ++++ b/lib/bundler.rb +@@ -170,8 +170,7 @@ def user_home + end + + if warning +- Kernel.send(:require, "etc") +- user_home = tmp_home_path(Etc.getlogin, warning) ++ user_home = tmp_home_path(warning) + Bundler.ui.warn "#{warning}\nBundler will use `#{user_home}' as your home directory temporarily.\n" + user_home + else +@@ -180,21 +180,6 @@ def user_home + end + end + +- def tmp_home_path(login, warning) +- login ||= "unknown" +- Kernel.send(:require, "tmpdir") +- path = Pathname.new(Dir.tmpdir).join("bundler", "home") +- SharedHelpers.filesystem_access(path) do |tmp_home_path| +- unless tmp_home_path.exist? +- tmp_home_path.mkpath +- tmp_home_path.chmod(0o777) +- end +- tmp_home_path.join(login).tap(&:mkpath) +- end +- rescue RuntimeError => e +- raise e.exception("#{warning}\nBundler also failed to create a temporary home directory at `#{path}':\n#{e}") +- end +- + def user_bundle_path(dir = "home") + env_var, fallback = case dir + when "home" +@@ -555,6 +555,17 @@ def configure_gem_home + Bundler.rubygems.clear_paths + end + ++ def tmp_home_path(warning) ++ Kernel.send(:require, "tmpdir") ++ SharedHelpers.filesystem_access(Dir.tmpdir) do ++ path = Bundler.tmp ++ at_exit { Bundler.rm_rf(path) } ++ path ++ end ++ rescue RuntimeError => e ++ raise e.exception("#{warning}\nBundler also failed to create a temporary home directory':\n#{e}") ++ end ++ + # @param env [Hash] + def with_env(env) + backup = ENV.to_hash +diff --git a/spec/bundler/bundler/bundler_spec.rb b/spec/bundler/bundler/bundler_spec.rb +index 74cf7ae05d3..247838600bf 100644 +--- a/spec/bundler/bundler/bundler_spec.rb ++++ b/spec/bundler/bundler/bundler_spec.rb +@@ -232,16 +232,13 @@ + path = "/home/oggy" + allow(Bundler.rubygems).to receive(:user_home).and_return(path) + allow(File).to receive(:directory?).with(path).and_return false +- allow(Etc).to receive(:getlogin).and_return("USER") +- allow(Dir).to receive(:tmpdir).and_return("/TMP") +- allow(FileTest).to receive(:exist?).with("/TMP/bundler/home").and_return(true) +- expect(FileUtils).to receive(:mkpath).with("/TMP/bundler/home/USER") ++ allow(Bundler).to receive(:tmp).and_return(Pathname.new("/tmp/trulyrandom")) + message = < Date: Thu, 4 Nov 2021 23:53:20 +0100 Subject: [PATCH 12/13] Upgrade Ruby to 2.6.8. --- ...ddle-1.0.0-ffi-closure-alloc-default.patch | 11 +- ruby-2.7.2-psych-fix-yaml-tests.patch | 162 ------------------ ...-the-fact-that-lchmod-can-EOPNOTSUPP.patch | 91 ---------- ruby.spec | 17 +- ...emporary-directory-as-home-directory.patch | 6 +- sources | 2 +- 6 files changed, 13 insertions(+), 276 deletions(-) delete mode 100644 ruby-2.7.2-psych-fix-yaml-tests.patch delete mode 100644 ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch diff --git a/ruby-2.6.3-fiddle-1.0.0-ffi-closure-alloc-default.patch b/ruby-2.6.3-fiddle-1.0.0-ffi-closure-alloc-default.patch index c54f1e4..ec99472 100644 --- a/ruby-2.6.3-fiddle-1.0.0-ffi-closure-alloc-default.patch +++ b/ruby-2.6.3-fiddle-1.0.0-ffi-closure-alloc-default.patch @@ -2,15 +2,12 @@ diff --git a/ext/fiddle/closure.c b/ext/fiddle/closure.c index 1a80b2b..b997e23 100644 --- a/ext/fiddle/closure.c +++ b/ext/fiddle/closure.c -@@ -13,25 +13,11 @@ typedef struct { +@@ -13,22 +13,11 @@ typedef struct { ffi_type **argv; } fiddle_closure; -#if defined(USE_FFI_CLOSURE_ALLOC) --#elif defined(__OpenBSD__) || defined(__APPLE__) || defined(__linux__) --# define USE_FFI_CLOSURE_ALLOC 0 --#elif defined(RUBY_LIBFFI_MODVERSION) && RUBY_LIBFFI_MODVERSION < 3000005 && \ -- (defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || defined(_M_AMD64)) +-#elif !defined(HAVE_FFI_CLOSURE_ALLOC) -# define USE_FFI_CLOSURE_ALLOC 0 -#else -# define USE_FFI_CLOSURE_ALLOC 1 @@ -28,7 +25,7 @@ index 1a80b2b..b997e23 100644 if (cls->argv) xfree(cls->argv); xfree(cls); } -@@ -205,12 +191,7 @@ allocate(VALUE klass) +@@ -202,12 +188,7 @@ allocate(VALUE klass) VALUE i = TypedData_Make_Struct(klass, fiddle_closure, &closure_data_type, closure); @@ -41,7 +38,7 @@ index 1a80b2b..b997e23 100644 return i; } -@@ -257,17 +238,8 @@ initialize(int rbargc, VALUE argv[], VALUE self) +@@ -254,17 +238,8 @@ initialize(int rbargc, VALUE argv[], VALUE self) if (FFI_OK != result) rb_raise(rb_eRuntimeError, "error prepping CIF %d", result); diff --git a/ruby-2.7.2-psych-fix-yaml-tests.patch b/ruby-2.7.2-psych-fix-yaml-tests.patch deleted file mode 100644 index 5a4be77..0000000 --- a/ruby-2.7.2-psych-fix-yaml-tests.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 3c55d93cf68b1a969b90b306de4dd8b88d74a2f2 Mon Sep 17 00:00:00 2001 -From: nagachika -Date: Sat, 13 Jun 2020 11:29:51 +0900 -Subject: [PATCH] merge revision(s) 7e289cdf3fed588b2d5a6973e29f9ff95cb8d76c: - [Backport #16949] - - [ruby/psych] Fixing compatibility with libyaml 0.2.5 - - The main issue is that commas aren't allowed in local tags. libyaml - was updated to follow the spec, and our tests were out of date. - - See: https://github.com/yaml/libyaml/issues/196 - - https://github.com/ruby/psych/commit/3f5e520fd3 ---- - test/psych/test_nil.rb | 4 ++-- - test/psych/test_psych.rb | 17 +++++++---------- - test/psych/test_yaml.rb | 24 ++++++++++++------------ - version.h | 4 ++-- - 4 files changed, 23 insertions(+), 26 deletions(-) - -diff --git a/test/psych/test_nil.rb b/test/psych/test_nil.rb -index 910a2e697def..bcbbcb9c9397 100644 ---- a/test/psych/test_nil.rb -+++ b/test/psych/test_nil.rb -@@ -5,13 +5,13 @@ module Psych - class TestNil < TestCase - def test_nil - yml = Psych.dump nil -- assert_match(/--- \n(?:\.\.\.\n)?/, yml) -+ assert_match(/---[ ]?\n(?:\.\.\.\n)?/, yml) - assert_nil Psych.load(yml) - end - - def test_array_nil - yml = Psych.dump [nil] -- assert_equal "---\n- \n", yml -+ assert_match(/---\n-[ ]?\n/, yml) - assert_equal [nil], Psych.load(yml) - end - -diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb -index eeadc864ef4e..e557feffb76a 100644 ---- a/test/psych/test_psych.rb -+++ b/test/psych/test_psych.rb -@@ -178,17 +178,17 @@ def test_add_builtin_type - - def test_domain_types - got = nil -- Psych.add_domain_type 'foo.bar,2002', 'foo' do |type, val| -+ Psych.add_domain_type 'foo.bar/2002', 'foo' do |type, val| - got = val - end - -- Psych.load('--- !foo.bar,2002/foo hello') -+ Psych.load('--- !foo.bar/2002:foo hello') - assert_equal 'hello', got - -- Psych.load("--- !foo.bar,2002/foo\n- hello\n- world") -+ Psych.load("--- !foo.bar/2002:foo\n- hello\n- world") - assert_equal %w{ hello world }, got - -- Psych.load("--- !foo.bar,2002/foo\nhello: world") -+ Psych.load("--- !foo.bar/2002:foo\nhello: world") - assert_equal({ 'hello' => 'world' }, got) - end - -@@ -295,16 +295,13 @@ def test_callbacks - types = [] - appender = lambda { |*args| types << args } - -- Psych.add_builtin_type('foo', &appender) -- Psych.add_domain_type('example.com,2002', 'foo', &appender) -+ Psych.add_domain_type('example.com:2002', 'foo', &appender) - Psych.load <<-eoyml --- !tag:yaml.org,2002:foo bar --- !tag:example.com,2002:foo bar -+- !tag:example.com:2002:foo bar - eoyml - - assert_equal [ -- ["tag:yaml.org,2002:foo", "bar"], -- ["tag:example.com,2002:foo", "bar"] -+ ["tag:example.com:2002:foo", "bar"] - ], types - end - -diff --git a/test/psych/test_yaml.rb b/test/psych/test_yaml.rb -index 5fa759c981b2..0dfd60f89434 100644 ---- a/test/psych/test_yaml.rb -+++ b/test/psych/test_yaml.rb -@@ -617,11 +617,11 @@ def test_spec_domain_prefix - raise ArgumentError, "Not a Hash in domain.tld,2002/invoice: " + val.inspect - end - } -- Psych.add_domain_type( "domain.tld,2002", 'invoice', &customer_proc ) -- Psych.add_domain_type( "domain.tld,2002", 'customer', &customer_proc ) -+ Psych.add_domain_type( "domain.tld/2002", 'invoice', &customer_proc ) -+ Psych.add_domain_type( "domain.tld/2002", 'customer', &customer_proc ) - assert_parse_only( { "invoice"=> { "customers"=> [ { "given"=>"Chris", "type"=>"domain customer", "family"=>"Dumars" } ], "type"=>"domain invoice" } }, <7, "center"=>{"x"=>73, "y"=>129}, "TYPE"=>"Shape: graph/circle"}, {"finish"=>{"x"=>89, "y"=>102}, "TYPE"=>"Shape: graph/line", "start"=>{"x"=>73, "y"=>129}}, {"TYPE"=>"Shape: graph/text", "value"=>"Pretty vector drawing.", "start"=>{"x"=>73, "y"=>129}, "color"=>16772795}, "Shape Container"]], < -Date: Thu, 23 Jan 2020 15:33:42 +0900 -Subject: [PATCH 1/2] brace the fact that lchmod(2) can EOPNOTSUPP - -Musl libc has this function as a tiny wrapper of fchmodat(3posix). On -the other hand Linux kernel does not support changing modes of a symlink. -The operation always fails with EOPNOTSUPP. This fchmodat behaviour is -defined in POSIX. We have to take care of such exceptions. ---- - lib/fileutils.rb | 3 ++- - test/pathname/test_pathname.rb | 2 +- - test/ruby/test_notimp.rb | 19 ++++++++++++------- - 3 files changed, 15 insertions(+), 9 deletions(-) - -diff --git a/lib/fileutils.rb b/lib/fileutils.rb -index 8981ef98e8..6332fcd6f1 100644 ---- a/lib/fileutils.rb -+++ b/lib/fileutils.rb -@@ -1320,6 +1320,7 @@ def chmod(mode) - else - File.chmod mode, path() - end -+ rescue Errno::EOPNOTSUPP - end - - def chown(uid, gid) -@@ -1411,7 +1412,7 @@ def copy_metadata(path) - if st.symlink? - begin - File.lchmod mode, path -- rescue NotImplementedError -+ rescue NotImplementedError, Errno::EOPNOTSUPP - end - else - File.chmod mode, path -diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb -index f8e4937802..750fabf039 100644 ---- a/test/pathname/test_pathname.rb -+++ b/test/pathname/test_pathname.rb -@@ -824,7 +824,7 @@ def test_lchmod - old = path.lstat.mode - begin - path.lchmod(0444) -- rescue NotImplementedError -+ rescue NotImplementedError, Errno::EOPNOTSUPP - next - end - assert_equal(0444, path.lstat.mode & 0777) -diff --git a/test/ruby/test_notimp.rb b/test/ruby/test_notimp.rb -index ddebb657bf..daa5a82d7b 100644 ---- a/test/ruby/test_notimp.rb -+++ b/test/ruby/test_notimp.rb -@@ -13,11 +13,11 @@ def test_respond_to_fork - - def test_respond_to_lchmod - assert_include(File.methods, :lchmod) -- if /linux/ =~ RUBY_PLATFORM -- assert_equal(false, File.respond_to?(:lchmod)) -- end -- if /freebsd/ =~ RUBY_PLATFORM -+ case RUBY_PLATFORM -+ when /freebsd/, /linux-musl/ - assert_equal(true, File.respond_to?(:lchmod)) -+ when /linux/ -+ assert_equal(false, File.respond_to?(:lchmod)) - end - end - -@@ -57,9 +57,14 @@ def test_call_lchmod - File.open(f, "w") {} - File.symlink f, g - newmode = 0444 -- File.lchmod newmode, "#{d}/g" -- snew = File.lstat(g) -- assert_equal(newmode, snew.mode & 0777) -+ begin -+ File.lchmod newmode, "#{d}/g" -+ rescue Errno::EOPNOTSUPP -+ skip $! -+ else -+ snew = File.lstat(g) -+ assert_equal(newmode, snew.mode & 0777) -+ end - } - end - end --- -2.26.2 - diff --git a/ruby.spec b/ruby.spec index 47b8e6d..9751468 100644 --- a/ruby.spec +++ b/ruby.spec @@ -1,6 +1,6 @@ %global major_version 2 %global minor_version 6 -%global teeny_version 7 +%global teeny_version 8 %global major_minor_version %{major_version}.%{minor_version} %global ruby_version %{major_minor_version}.%{teeny_version} @@ -21,7 +21,7 @@ %endif -%global release 128 +%global release 129 %{!?release_string:%global release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}} # The RubyGems library has to stay out of Ruby directory tree, since the @@ -49,7 +49,7 @@ %global power_assert_version 1.1.3 %global psych_version 3.1.0 %global rake_version 12.3.3 -%global rdoc_version 6.1.2 +%global rdoc_version 6.1.2.1 %global test_unit_version 3.2.9 %global xmlrpc_version 0.3.0 @@ -148,9 +148,6 @@ Patch11: rubygems-3.0.3-Restore-gem-build-behavior-and-introdcue-the-C-flag-to-g # https://github.com/rubygems/rubygems/pull/2604 Patch12: rubygems-3.0.3-Avoid-rdoc-hook-when-its-failed-to-load-rdoc-library.patch -# Fix compatibility with libyaml 0.2.5 -# https://bugs.ruby-lang.org/issues/16949 -Patch14: ruby-2.7.2-psych-fix-yaml-tests.patch # Fix DWARF5 support. # https://bugzilla.redhat.com/show_bug.cgi?id=1920533 # https://bugs.ruby-lang.org/issues/17585 @@ -182,8 +179,6 @@ Patch26: ruby-3.0.0-Convert-ip-addresses-to-canonical-form.patch # https://github.com/rubygems/bundler/pull/7416 Patch27: rubygem-bundler-2.1.0-dont-use-insecure-temporary-directory-as-home-directory.patch # Fix lchmod test failures. -# https://github.com/ruby/ruby/commit/a19228f878d955eaf2cce086bcf53f46fdf894b9 -Patch41: ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch # https://github.com/ruby/ruby/commit/72c02aa4b79731c7f25c9267f74b347f1946c704 Patch42: ruby-2.8.0-Moved-not-implemented-method-tests.patch @@ -577,7 +572,6 @@ rm -rf ext/fiddle/libffi* %patch9 -p1 %patch11 -p1 %patch12 -p1 -%patch14 -p1 %patch15 -p1 %patch19 -p1 %patch22 -p1 @@ -585,7 +579,6 @@ rm -rf ext/fiddle/libffi* %patch25 -p1 %patch26 -p1 %patch27 -p1 -%patch41 -p1 %patch42 -p1 # Provide an example of usage of the tapset: @@ -1245,8 +1238,8 @@ MSPECOPTS="$MSPECOPTS -P 'File.lchmod raises a NotImplementedError when called'" %{_mandir}/man5/gemfile.5* %changelog -* Wed Apr 14 2021 Jarek Prokop - 2.6.7-128 -- Upgrade to Ruby 2.6.7. +* Fri Nov 12 2021 Pavel Valena - 2.6.8-129 +- Upgrade Ruby to 2.6.8. - Resolv::DNS: timeouts if multiple IPv6 name servers are given an address containing leading zero - Fix: Rubygem-bundler: Don't use insecure tmp directory as home diff --git a/rubygem-bundler-2.1.0-dont-use-insecure-temporary-directory-as-home-directory.patch b/rubygem-bundler-2.1.0-dont-use-insecure-temporary-directory-as-home-directory.patch index 948f79d..794a65d 100644 --- a/rubygem-bundler-2.1.0-dont-use-insecure-temporary-directory-as-home-directory.patch +++ b/rubygem-bundler-2.1.0-dont-use-insecure-temporary-directory-as-home-directory.patch @@ -67,7 +67,7 @@ diff --git a/spec/bundler/bundler/bundler_spec.rb b/spec/bundler/bundler/bundler index 74cf7ae05d3..247838600bf 100644 --- a/spec/bundler/bundler/bundler_spec.rb +++ b/spec/bundler/bundler/bundler_spec.rb -@@ -232,16 +232,13 @@ +@@ -233,16 +233,13 @@ path = "/home/oggy" allow(Bundler.rubygems).to receive(:user_home).and_return(path) allow(File).to receive(:directory?).with(path).and_return false @@ -87,7 +87,7 @@ index 74cf7ae05d3..247838600bf 100644 end end -@@ -254,16 +251,13 @@ +@@ -255,16 +252,13 @@ allow(File).to receive(:directory?).with(path).and_return true allow(File).to receive(:writable?).with(path).and_return false allow(File).to receive(:directory?).with(dotbundle).and_return false @@ -107,7 +107,7 @@ index 74cf7ae05d3..247838600bf 100644 end context ".bundle exists and have correct permissions" do -@@ -282,31 +276,17 @@ +@@ -283,31 +277,17 @@ context "home directory is not set" do it "should issue warning and return a temporary user home" do allow(Bundler.rubygems).to receive(:user_home).and_return(nil) diff --git a/sources b/sources index 46f9d39..01ed2dc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ruby-2.6.7.tar.xz) = ba6fc0a36af2a08cf1b008851e805f59ea1047724fc7b61d4bc674533b8f123cb12fa0969e9a3f57290477c0d75f974ca7e304836e4905bd96a737211df9bd21 +SHA512 (ruby-2.6.8.tar.xz) = d040ad2238523587d8f356fcb796b8b6ad7f8caff7dd6df09e3f7efcbfa0369e33600e78c7f2bc713ae77c040757cce5c4fec223cb9070209f2bf741899c556d From d85283a96f3c04c450192c90aab84c5c84c8a46a Mon Sep 17 00:00:00 2001 From: Pavel Valena Date: Sun, 5 Dec 2021 15:53:44 +0100 Subject: [PATCH 13/13] Upgrade to Ruby 2.6.9. --- ruby.spec | 9 ++++++--- sources | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ruby.spec b/ruby.spec index 9751468..16100d9 100644 --- a/ruby.spec +++ b/ruby.spec @@ -1,6 +1,6 @@ %global major_version 2 %global minor_version 6 -%global teeny_version 8 +%global teeny_version 9 %global major_minor_version %{major_version}.%{minor_version} %global ruby_version %{major_minor_version}.%{teeny_version} @@ -21,7 +21,7 @@ %endif -%global release 129 +%global release 130 %{!?release_string:%global release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}} # The RubyGems library has to stay out of Ruby directory tree, since the @@ -1095,7 +1095,7 @@ MSPECOPTS="$MSPECOPTS -P 'File.lchmod raises a NotImplementedError when called'" # TODO: Gemify these libraries %{gem_dir}/specifications/default/cmath-1.0.0.gemspec %{gem_dir}/specifications/default/csv-3.0.9.gemspec -%{gem_dir}/specifications/default/date-2.0.0.gemspec +%{gem_dir}/specifications/default/date-2.0.2.gemspec %{gem_dir}/specifications/default/dbm-1.0.0.gemspec %{gem_dir}/specifications/default/e2mmap-0.1.0.gemspec %{gem_dir}/specifications/default/etc-1.0.1.gemspec @@ -1238,6 +1238,9 @@ MSPECOPTS="$MSPECOPTS -P 'File.lchmod raises a NotImplementedError when called'" %{_mandir}/man5/gemfile.5* %changelog +* Sun Dec 05 2021 Pavel Valena - 2.6.9-130 +- Upgrade to Ruby 2.6.9. + * Fri Nov 12 2021 Pavel Valena - 2.6.8-129 - Upgrade Ruby to 2.6.8. - Resolv::DNS: timeouts if multiple IPv6 name servers are given an address diff --git a/sources b/sources index 01ed2dc..6cd8b2f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (ruby-2.6.8.tar.xz) = d040ad2238523587d8f356fcb796b8b6ad7f8caff7dd6df09e3f7efcbfa0369e33600e78c7f2bc713ae77c040757cce5c4fec223cb9070209f2bf741899c556d +SHA512 (ruby-2.6.9.tar.xz) = f60aa89e685cea324185eb0d13e6b44caef4e4f761cbf9ea1386ae70e39faf3866ac01e4bb5354574f2583e74290b8c80eaf63d126040d52368be6c771476451