This commit is contained in:
Mamoru TASAKA 2023-12-29 15:33:20 +09:00
parent ea58e84d09
commit dd5ce8edc9
4 changed files with 7 additions and 89 deletions

View File

@ -1,42 +0,0 @@
From 374f3281a67ab3a3e52ebe6deacc0548b3f1b96a Mon Sep 17 00:00:00 2001
From: Mike Dalessio <mike.dalessio@gmail.com>
Date: Mon, 4 Sep 2023 12:58:45 -0400
Subject: [PATCH] test: update to handle upstream libxml2 error changes
The behavior changed in libxml2 commit 53050b1d
---
test/xml/test_reader.rb | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/test/xml/test_reader.rb b/test/xml/test_reader.rb
index 4b5b5c5728..e5f01d32ec 100644
--- a/test/xml/test_reader.rb
+++ b/test/xml/test_reader.rb
@@ -765,7 +765,12 @@ def test_broken_markup_attribute_hash
e = assert_raises(Nokogiri::XML::SyntaxError) do
reader.attribute_hash
end
- assert_includes(e.message, "FATAL: Extra content at the end of the document")
+ expected = if Nokogiri.uses_libxml?(">= 2.12.0") # upstream commit 53050b1d
+ "FATAL: Premature end of data in tag foo line 1"
+ else
+ "FATAL: Extra content at the end of the document"
+ end
+ assert_includes(e.message, expected)
end
assert_equal(1, reader.errors.length)
@@ -796,7 +801,12 @@ def test_broken_markup_namespaces
e = assert_raises(Nokogiri::XML::SyntaxError) do
reader.namespaces
end
- assert_includes(e.message, "FATAL: Extra content at the end of the document")
+ expected = if Nokogiri.uses_libxml?(">= 2.12.0") # upstream commit 53050b1d
+ "FATAL: Premature end of data in tag foo line 1"
+ else
+ "FATAL: Extra content at the end of the document"
+ end
+ assert_includes(e.message, expected)
end
assert_equal(1, reader.errors.length)

View File

@ -1,37 +0,0 @@
From 5e60c08c6ec75ec8767f3edbfcba0d8e39d06495 Mon Sep 17 00:00:00 2001
From: Mike Dalessio <mike.dalessio@gmail.com>
Date: Tue, 24 Oct 2023 08:54:19 -0400
Subject: [PATCH] fix: work around change in upstream libxml2 recovery
See:
- https://gitlab.gnome.org/GNOME/libxml2/-/issues/598
- https://gitlab.gnome.org/GNOME/libxml2/-/commit/c082ef4644ce1f0af2a7c01e27c4a75f4d7d4feb
---
test/xml/sax/test_push_parser.rb | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/test/xml/sax/test_push_parser.rb b/test/xml/sax/test_push_parser.rb
index 5c9ddd3840..aa7ce84e8e 100644
--- a/test/xml/sax/test_push_parser.rb
+++ b/test/xml/sax/test_push_parser.rb
@@ -182,12 +182,18 @@ def error(msg)
it :test_broken_encoding do
skip_unless_libxml2("ultra hard to fix for pure Java version")
+
parser.options |= Nokogiri::XML::ParseOptions::RECOVER
# This is ISO_8859-1:
parser << "<?xml version='1.0' encoding='UTF-8'?><r>Gau\337</r>"
parser.finish
+
assert(parser.document.errors.size >= 1)
- assert_equal "Gau\337", parser.document.data.join
+
+ # the interpretation of the byte may vary by libxml2 version in recovery mode
+ # see for example https://gitlab.gnome.org/GNOME/libxml2/-/issues/598
+ assert(parser.document.data.join.start_with?("Gau"))
+
assert_equal [["r"]], parser.document.end_elements
end

View File

@ -1,4 +1,4 @@
%global mainver 1.15.5 %global mainver 1.16.0
#%%global prever .rc4 #%%global prever .rc4
%global baserelease 1 %global baserelease 1
@ -29,10 +29,6 @@ Source1: rubygem-%{gem_name}-%{version}%{?prever}-full.tar.gz
Source2: nokogiri-create-full-tarball.sh Source2: nokogiri-create-full-tarball.sh
# Shut down libxml2 version unmatching warning # Shut down libxml2 version unmatching warning
Patch0: %{name}-1.11.0.rc4-shutdown-libxml2-warning.patch Patch0: %{name}-1.11.0.rc4-shutdown-libxml2-warning.patch
# https://github.com/sparklemotion/nokogiri/pull/2973
Patch1: nokogiri-pr2973-libxml2-2_12_0-error-msg-change.patch
# https://github.com/sparklemotion/nokogiri/pull/3013
Patch2: nokogiri-pr3013-libxml2-2_12_0-recovery-char-change.patch
BuildRequires: ruby(release) BuildRequires: ruby(release)
BuildRequires: ruby(rubygems) BuildRequires: ruby(rubygems)
## ##
@ -85,8 +81,6 @@ mv ../%{gem_name}-%{version}.gemspec .
# patches # patches
%patch -P0 -p1 %patch -P0 -p1
%patch -P1 -p1
%patch -P2 -p1
# remove bundled external libraries # remove bundled external libraries
sed -i \ sed -i \
@ -211,7 +205,7 @@ pushd ./%{gem_instdir}
# Remove unneeded simplecov coverage test # Remove unneeded simplecov coverage test
sed -i test/helper.rb \ sed -i test/helper.rb \
-e '\@require.*simplecov@,\@^end$@s|^|#|' -e '\@^ require.*simplecov@,\@^ end$@s|^|#|'
# Remove minitest-reporters. It does not provide any additional value while # Remove minitest-reporters. It does not provide any additional value while
# it blows up the dependency chain. # it blows up the dependency chain.
@ -272,6 +266,9 @@ popd
%doc %{gem_dir}/doc/%{gem_name}-%{mainver}%{?prever}/ %doc %{gem_dir}/doc/%{gem_name}-%{mainver}%{?prever}/
%changelog %changelog
* Fri Dec 29 2023 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.16.0-1
- 1.16.0
* Sat Nov 18 2023 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.15.5-1 * Sat Nov 18 2023 Mamoru TASAKA <mtasaka@fedoraproject.org> - 1.15.5-1
- 1.15.5 - 1.15.5
- Backport upstream patch for libxml2 2.12.0 error handling change - Backport upstream patch for libxml2 2.12.0 error handling change

View File

@ -1,2 +1,2 @@
SHA512 (nokogiri-1.15.5.gem) = 3f6c2febbdef2cc7e34b5555479b614165a4b3aaa8b46340812e2a736b3efd12c0d0e79c64ad2313a3d99326fd802eaab74eeda08c4ccd9a949974df69e0fe0f SHA512 (nokogiri-1.16.0.gem) = 4fdb498f285822f518eb7c89ef2e674f4d2f78d10dec92002c60528b87a27edc440bee9e21360ca2a1c8691785b43e6d453b8d7c319f87d019789d7c599880df
SHA512 (rubygem-nokogiri-1.15.5-full.tar.gz) = 606b8fcc3483d4d834dc4cd9df73e56dbba6ad2c5c26223072f38f5e59b6746d913b73d9e3a6ffd4c5e52d5311c4efb0a78d3adae4545d6efdf826e4ab6a6985 SHA512 (rubygem-nokogiri-1.16.0-full.tar.gz) = 0343e051c2694934db2b2e869887679e61dbb64dcb0d6e5dc83be25e5ea4e0d5637fb59e5d2ece58cd16e6ffb514d2b5c8bb6337eb89fc05398622572fc446e5