From 71ccaf1b3cd4d83dd305fdcd8d74a1683da2d043 Mon Sep 17 00:00:00 2001 From: ZhouWeitao Date: Thu, 13 Jan 2022 14:11:40 +0800 Subject: [PATCH 1/2] Fix FTBFS due to glibc 2.31.9000 implementing lchmod(2), compatible with glibc2.28 also - Patch: ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch - Patch: ruby-2.8.0-Moved-not-implemented-method-tests.patch refer url: https://src.fedoraproject.org/rpms/ruby/c/79683d7d629de74dbcefe8cce68d51ec1eb1da01?branch=rawhide Signed-off-by: ZhouWeitao --- ...-the-fact-that-lchmod-can-EOPNOTSUPP.patch | 91 +++++++++++++ ...0-Moved-not-implemented-method-tests.patch | 128 ++++++++++++++++++ ruby.spec | 19 ++- 3 files changed, 237 insertions(+), 1 deletion(-) create mode 100644 1000-ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch create mode 100644 1001-ruby-2.8.0-Moved-not-implemented-method-tests.patch diff --git a/1000-ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch b/1000-ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch new file mode 100644 index 0000000..42f47a9 --- /dev/null +++ b/1000-ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch @@ -0,0 +1,91 @@ +From 29d9f866f686e81818fb9cf402c4fb479decb282 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 f56d7f9cb9..1a02d5435e 100644 +--- a/lib/fileutils.rb ++++ b/lib/fileutils.rb +@@ -1242,6 +1242,7 @@ def chmod(mode) + else + File.chmod mode, path() + end ++ rescue Errno::EOPNOTSUPP + end + + def chown(uid, gid) +@@ -1317,7 +1318,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 8a72b8026d..e381d3fa58 100644 +--- a/test/pathname/test_pathname.rb ++++ b/test/pathname/test_pathname.rb +@@ -823,7 +823,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/1001-ruby-2.8.0-Moved-not-implemented-method-tests.patch b/1001-ruby-2.8.0-Moved-not-implemented-method-tests.patch new file mode 100644 index 0000000..72d09bc --- /dev/null +++ b/1001-ruby-2.8.0-Moved-not-implemented-method-tests.patch @@ -0,0 +1,128 @@ +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 0eba7bdaf8..be8c3623cc 100644 +--- a/test/-ext-/test_notimplement.rb ++++ b/test/-ext-/test_notimplement.rb +@@ -10,6 +10,11 @@ def test_funcall_notimplement + end + + def test_respond_to ++ assert_include(Bug.methods(false), :notimplement) + assert_not_respond_to(Bug, :notimplement) + end ++ ++ def test_method_inspect_notimplement ++ assert_match(/not-implemented/, Bug.method(:notimplement).inspect) ++ end + end +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 fc59c29..6074aa1 100644 --- a/ruby.spec +++ b/ruby.spec @@ -1,3 +1,4 @@ +%define anolis_release .0.1 %global major_version 2 %global minor_version 5 %global teeny_version 9 @@ -23,7 +24,7 @@ %global release 107 -%{!?release_string:%global release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}} +%{!?release_string:%global release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{anolis_release}%{?dist}} # The RubyGems library has to stay out of Ruby directory tree, since the # RubyGems should be share by all Ruby implementations. @@ -179,6 +180,15 @@ Patch28: ruby-2.5.9-revert-stop-the-error-due-to-openssl-1-1-1h.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1955010 Patch29: ruby-3.0.0-Convert-ip-addresses-to-canonical-form.patch +# Begin: Anolis OS customized +# Fix lchmod test failures. +# refer url: https://src.fedoraproject.org/rpms/ruby/c/79683d7d629de74dbcefe8cce68d51ec1eb1da01?branch=rawhide +# https://github.com/ruby/ruby/commit/a19228f878d955eaf2cce086bcf53f46fdf894b9 +Patch1000: 1000-ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch +# https://github.com/ruby/ruby/commit/72c02aa4b79731c7f25c9267f74b347f1946c704 +Patch1001: 1001-ruby-2.8.0-Moved-not-implemented-method-tests.patch +# End: Anolis OS customized + Requires: %{name}-libs%{?_isa} = %{version}-%{release} Suggests: rubypick Recommends: ruby(rubygems) >= %{rubygems_version} @@ -577,6 +587,8 @@ sed -i 's/"evaluation\/incorrect_words.yaml"\.freeze, //' \ %patch27 -p1 %patch28 -p1 -R %patch29 -p1 +%patch1000 -p1 +%patch1001 -p1 # Provide an example of usage of the tapset: cp -a %{SOURCE3} . @@ -1129,6 +1141,11 @@ OPENSSL_SYSTEM_CIPHERS_OVERRIDE=xyz_nonexistent_file OPENSSL_CONF='' \ %{gem_dir}/specifications/xmlrpc-%{xmlrpc_version}.gemspec %changelog +* Thu Jan 13 2022 Weitao Zhou - 2.5.9-107.0.1 +- Fix FTBFS due to glibc 2.31.9000 implementing lchmod(2), compatible with glibc2.28 also + * Patch: ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch + * Patch: ruby-2.8.0-Moved-not-implemented-method-tests.patch + * Mon Apr 19 2021 Pavel Valena - 2.5.9-107 - Update to Ruby 2.5.9. * Remove Patch20: ruby-2.6.0-rdoc-6.0.1-fix-template-typo.patch; subsumed -- Gitee From f41df57f7c696cade46f808ea422facd02cb7f43 Mon Sep 17 00:00:00 2001 From: ZhouWeitao Date: Thu, 13 Jan 2022 14:58:38 +0800 Subject: [PATCH 2/2] Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add. - Patch: ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch refer url: https://src.fedoraproject.org/rpms/ruby/c/4979be53acdcfd0d6021c4f209403c2e88fae58e?branch=rawhide Signed-off-by: ZhouWeitao --- ..._bug_reporter_add-witout-raising-err.patch | 34 +++++++++++++++++++ ruby.spec | 7 ++++ 2 files changed, 41 insertions(+) create mode 100644 1002-ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch diff --git a/1002-ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch b/1002-ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch new file mode 100644 index 0000000..b7ea046 --- /dev/null +++ b/1002-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 +@@ -17,7 +17,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 6074aa1..b84e406 100644 --- a/ruby.spec +++ b/ruby.spec @@ -187,6 +187,10 @@ Patch29: ruby-3.0.0-Convert-ip-addresses-to-canonical-form.patch Patch1000: 1000-ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch # https://github.com/ruby/ruby/commit/72c02aa4b79731c7f25c9267f74b347f1946c704 Patch1001: 1001-ruby-2.8.0-Moved-not-implemented-method-tests.patch +# Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add. +# https://bugs.ruby-lang.org/issues/16492 +# refer url: https://src.fedoraproject.org/rpms/ruby/c/4979be53acdcfd0d6021c4f209403c2e88fae58e?branch=rawhide +Patch1002: 1002-ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch # End: Anolis OS customized Requires: %{name}-libs%{?_isa} = %{version}-%{release} @@ -589,6 +593,7 @@ sed -i 's/"evaluation\/incorrect_words.yaml"\.freeze, //' \ %patch29 -p1 %patch1000 -p1 %patch1001 -p1 +%patch1002 -p1 # Provide an example of usage of the tapset: cp -a %{SOURCE3} . @@ -1145,6 +1150,8 @@ OPENSSL_SYSTEM_CIPHERS_OVERRIDE=xyz_nonexistent_file OPENSSL_CONF='' \ - Fix FTBFS due to glibc 2.31.9000 implementing lchmod(2), compatible with glibc2.28 also * Patch: ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch * Patch: ruby-2.8.0-Moved-not-implemented-method-tests.patch +- Avoid possible timeout errors in TestBugReporter#test_bug_reporter_add. + * Patch: ruby-2.7.1-Timeout-the-test_bug_reporter_add-witout-raising-err.patch * Mon Apr 19 2021 Pavel Valena - 2.5.9-107 - Update to Ruby 2.5.9. -- Gitee