Fix FTBFS due to glibc 2.31.9000 implementing lchmod(2).
This commit is contained in:
parent
7b6c9c5f13
commit
a4dab688e7
3 changed files with 238 additions and 0 deletions
91
ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch
Normal file
91
ruby-2.8.0-Brace-the-fact-that-lchmod-can-EOPNOTSUPP.patch
Normal file
|
|
@ -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?=
|
||||
<shyouhei@ruby-lang.org>
|
||||
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
|
||||
|
||||
134
ruby-2.8.0-Moved-not-implemented-method-tests.patch
Normal file
134
ruby-2.8.0-Moved-not-implemented-method-tests.patch
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
From 5400fc3c67446e2f7f35ea317c596e71f0cb1ca4 Mon Sep 17 00:00:00 2001
|
||||
From: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
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
|
||||
|
||||
13
ruby.spec
13
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 <pvalena@redhat.com> - 2.6.6-125
|
||||
- Upgrade to Ruby 2.6.6.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue