From 3c785b2cc148a2c3e7f84baad4bd28cc02b69bf2 Mon Sep 17 00:00:00 2001 From: ocs-bot Date: Tue, 8 Jul 2025 17:05:55 +0800 Subject: [PATCH 1/2] Rebuilt for libxml2 --- python-lxml.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python-lxml.spec b/python-lxml.spec index 2daa529..acfc7d6 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -1,7 +1,7 @@ Summary: XML processing library combining libxml2/libxslt with the ElementTree API Name: python-lxml Version: 4.9.3 -Release: 7%{?dist} +Release: 8%{?dist} License: BSD and MIT and zlib URL: https://github.com/lxml/lxml Source0: https://files.pythonhosted.org/packages/source/l/lxml/lxml-%{version}.tar.gz @@ -60,6 +60,10 @@ cp -a build/lib.%{python3_platform}-*/* src/ %{python3_sitearch}/lxml-*.egg-info/ %changelog +* Tue Jul 08 2025 Rebuild Robot - 4.9.3-8 +- [Type] security +- [DESC] Rebuilt for libxml2 + * Thu Sep 26 2024 OpenCloudOS Release Engineering - 4.9.3-7 - Rebuilt for clarifying the packages requirement in BaseOS and AppStream -- Gitee From 5fd8dc29fe569a685be66d35193c432e1e87570e Mon Sep 17 00:00:00 2001 From: jiaxinyyang Date: Tue, 8 Jul 2025 17:13:25 +0800 Subject: [PATCH 2/2] Make Unicode recovery test work with libxml2 2.12 (GH-383) --- fix_build_error_libxml2-2.12.patch | 41 ++++++++++++++++++++++++++++++ python-lxml.spec | 4 ++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 fix_build_error_libxml2-2.12.patch diff --git a/fix_build_error_libxml2-2.12.patch b/fix_build_error_libxml2-2.12.patch new file mode 100644 index 0000000..4bc4de4 --- /dev/null +++ b/fix_build_error_libxml2-2.12.patch @@ -0,0 +1,41 @@ +From 2a6770566ab57d601abc7c2f49a8051b9d97b64c Mon Sep 17 00:00:00 2001 +From: Nick Wellnhofer +Date: Tue, 31 Oct 2023 12:36:02 +0100 +Subject: [PATCH] Make Unicode recovery test work with libxml2 2.12 (GH-383) + +When encountering encoding errors, libxml2 no longer switches to ISO-8859-1 since version 2.12. +--- + src/lxml/parser.pxi | 2 +- + src/lxml/tests/test_unicode.py | 6 +++++- + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/src/lxml/parser.pxi b/src/lxml/parser.pxi +index 4b7b52065..8ceec7d25 100644 +--- a/src/lxml/parser.pxi ++++ b/src/lxml/parser.pxi +@@ -693,7 +693,7 @@ cdef xmlDoc* _handleParseResult(_ParserContext context, + # An encoding error occurred and libxml2 switched from UTF-8 + # input to (undecoded) Latin-1, at some arbitrary point in the + # document. Better raise an error than allowing for a broken +- # tree with mixed encodings. ++ # tree with mixed encodings. This is fixed in libxml2 2.12. + well_formed = 0 + elif recover or (c_ctxt.wellFormed and + c_ctxt.lastError.level < xmlerror.XML_ERR_ERROR): +diff --git a/src/lxml/tests/test_unicode.py b/src/lxml/tests/test_unicode.py +index 6d4ee9c0f..3636539b2 100644 +--- a/src/lxml/tests/test_unicode.py ++++ b/src/lxml/tests/test_unicode.py +@@ -167,7 +167,11 @@ def test_illegal_utf8(self): + def test_illegal_utf8_recover(self): + data = _bytes('\x80\x80\x80', encoding='iso8859-1') + parser = etree.XMLParser(recover=True) +- self.assertRaises(etree.XMLSyntaxError, etree.fromstring, data, parser) ++ if etree.LIBXML_VERSION >= (2, 12, 0): ++ tree = etree.fromstring(data, parser) ++ self.assertEqual('\ufffd\ufffd\ufffd', tree.text) ++ else: ++ self.assertRaises(etree.XMLSyntaxError, etree.fromstring, data, parser) + + def _test_encoding(self, encoding, xml_encoding_name=None): + foo = """\n""" % ( diff --git a/python-lxml.spec b/python-lxml.spec index acfc7d6..f7b96dc 100644 --- a/python-lxml.spec +++ b/python-lxml.spec @@ -11,6 +11,7 @@ Patch0002: https://github.com/lxml/lxml/pull/380.patch Patch0003: https://github.com/lxml/lxml/commit/dcbc0cc1cb0cedf8019184aaca805d2a649cd8de.patch Patch0004: https://github.com/lxml/lxml/commit/a03a4b3c6b906d33c5ef1a15f3d5ca5fff600c76.patch Patch0005: backport-Change-HTML-prefix-handling-in-ElementPath-to-let-el.patch +Patch0006: fix_build_error_libxml2-2.12.patch Patch3000: Skip-failing-test_iterparse_utf16_bom.patch Patch3001: Fix-test_elementtree-with-Expat-2.6.0.patch @@ -60,8 +61,9 @@ cp -a build/lib.%{python3_platform}-*/* src/ %{python3_sitearch}/lxml-*.egg-info/ %changelog -* Tue Jul 08 2025 Rebuild Robot - 4.9.3-8 +* Tue Jul 08 2025 Jiaxin Yang - 4.9.3-8 - [Type] security +- [DESC] Make Unicode recovery test work with libxml2 2.12 (GH-383) - [DESC] Rebuilt for libxml2 * Thu Sep 26 2024 OpenCloudOS Release Engineering - 4.9.3-7 -- Gitee