Remove the patch applied to pass the test/fiddle/test_import.rb on PPC.

In Ruby 3.0.3, a new logic with the hard-coded "libc.so.6" to detect glibc
works on PPC, both Power 8 and 9.
See <https://bugs.ruby-lang.org/issues/12666#note-13>.

Note the logic also fixes the following error on a Power 9 environment where
the path is `/lib64/glibc-hwcaps/power9/libc-2.28.so`.

```
/builddir/build/BUILD/ruby-2.6.9/.ext/common/fiddle/import.rb:299:in `import_function': cannot find the function: strcpy() (Fiddle::DLError)
    from /builddir/build/BUILD/ruby-2.6.9/.ext/common/fiddle/import.rb:172:in `extern'
    from /builddir/build/BUILD/ruby-2.6.9/test/fiddle/test_import.rb:17:in `<module:LIBC>'
    from /builddir/build/BUILD/ruby-2.6.9/test/fiddle/test_import.rb:10:in `<module:Fiddle>'
    from /builddir/build/BUILD/ruby-2.6.9/test/fiddle/test_import.rb:9:in `<top (required)>'
    from /builddir/build/BUILD/ruby-2.6.9/test/lib/test/unit.rb:958:in `require'
    from /builddir/build/BUILD/ruby-2.6.9/test/lib/test/unit.rb:958:in `block in non_options'
    from /builddir/build/BUILD/ruby-2.6.9/test/lib/test/unit.rb:952:in `each'
    from /builddir/build/BUILD/ruby-2.6.9/test/lib/test/unit.rb:952:in `non_options'
    from /builddir/build/BUILD/ruby-2.6.9/test/lib/test/unit.rb:64:in `process_args'
    from /builddir/build/BUILD/ruby-2.6.9/test/lib/test/unit.rb:130:in `process_args'
    from /builddir/build/BUILD/ruby-2.6.9/test/lib/test/unit.rb:1136:in `process_args'
    from /builddir/build/BUILD/ruby-2.6.9/test/lib/test/unit.rb:1141:in `run'
    from /builddir/build/BUILD/ruby-2.6.9/test/lib/test/unit.rb:1148:in `run'
    from ./test/runner.rb:33:in `<main>'
```

Related: rhbz#2049693
This commit is contained in:
Jun Aruga 2022-01-11 11:50:01 +01:00 committed by Vít Ondruch
parent ec672728cb
commit a937dc62ed
2 changed files with 3 additions and 38 deletions

View File

@ -1,30 +0,0 @@
From 346e147ba6480839b87046e9a9efab0bf6ed3660 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Wed, 10 Aug 2016 17:35:48 +0200
Subject: [PATCH] Rely on ldd to detect glibc.
This is just workaround, since we know we are quite sure this will be successful
on Red Hat platforms.
This workaround rhbz#1361037
---
test/fiddle/helper.rb | 3 +++
1 file changed, 3 insertions(+)
diff --git a/test/fiddle/helper.rb b/test/fiddle/helper.rb
index 1da3d93..65148a1 100644
--- a/test/fiddle/helper.rb
+++ b/test/fiddle/helper.rb
@@ -139,6 +139,9 @@
libc_so = libm_so = "/usr/lib/libSystem.B.dylib"
end
+# Just ignore the heuristic, because it is not reliable on all platforms.
+libc_so = libm_so = nil
+
if !libc_so || !libm_so
ruby = EnvUtil.rubybin
# When the ruby binary is 32-bit and the host is 64-bit,
--
2.9.2

View File

@ -22,7 +22,7 @@
%endif %endif
%global release 156 %global release 157
%{!?release_string:%define release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}} %{!?release_string:%define release_string %{?development_release:0.}%{release}%{?development_release:.%{development_release}}%{?dist}}
# The RubyGems library has to stay out of Ruby directory tree, since the # The RubyGems library has to stay out of Ruby directory tree, since the
@ -141,10 +141,6 @@ Patch5: ruby-1.9.3-mkmf-verbose.patch
# https://lists.fedoraproject.org/archives/list/ruby-sig@lists.fedoraproject.org/message/LH6L6YJOYQT4Y5ZNOO4SLIPTUWZ5V45Q/ # https://lists.fedoraproject.org/archives/list/ruby-sig@lists.fedoraproject.org/message/LH6L6YJOYQT4Y5ZNOO4SLIPTUWZ5V45Q/
# For now, load the ABRT hook via this simple patch: # For now, load the ABRT hook via this simple patch:
Patch6: ruby-2.7.0-Initialize-ABRT-hook.patch Patch6: ruby-2.7.0-Initialize-ABRT-hook.patch
# Workaround "an invalid stdio handle" error on PPC, due to recently introduced
# hardening features of glibc (rhbz#1361037).
# https://bugs.ruby-lang.org/issues/12666
Patch9: ruby-2.3.1-Rely-on-ldd-to-detect-glibc.patch
# Fix DWARF5 support. # Fix DWARF5 support.
# https://bugzilla.redhat.com/show_bug.cgi?id=1920533 # https://bugzilla.redhat.com/show_bug.cgi?id=1920533
# https://bugs.ruby-lang.org/issues/17585 # https://bugs.ruby-lang.org/issues/17585
@ -617,7 +613,6 @@ rm -rf ext/fiddle/libffi*
%patch4 -p1 %patch4 -p1
%patch5 -p1 %patch5 -p1
%patch6 -p1 %patch6 -p1
%patch9 -p1
%patch15 -p1 %patch15 -p1
%patch16 -p1 %patch16 -p1
%patch17 -p1 %patch17 -p1
@ -1443,8 +1438,8 @@ mv test/fiddle/test_import.rb{,.disable}
%changelog %changelog
* Thu Dec 09 2021 Vít Ondruch <vondruch@redhat.com> - 3.0.3-156 * Tue Jan 11 2022 Jun Aruga <jaruga@redhat.com> - 3.0.3-157
- Fix loading of default gems. - Remove the patch applied to pass the test/fiddle/test_import.rb on PPC.
Related: rhbz#2049693 Related: rhbz#2049693
* Thu Nov 25 2021 Vít Ondruch <vondruch@redhat.com> - 3.0.2-156 * Thu Nov 25 2021 Vít Ondruch <vondruch@redhat.com> - 3.0.2-156