Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/libxml2/, dev-libs/libxml2/files/
Date: Tue, 29 Nov 2022 19:59:08
Message-Id: 1669751924.bee4fbd32b0225d09bf7fca8d38b83a9ac368bfd.soap@gentoo
1 commit: bee4fbd32b0225d09bf7fca8d38b83a9ac368bfd
2 Author: David Seifert <soap <AT> gentoo <DOT> org>
3 AuthorDate: Tue Nov 29 19:58:44 2022 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 29 19:58:44 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bee4fbd3
7
8 dev-libs/libxml2: add workaround patch for itstool breakage
9
10 Bug: https://bugs.gentoo.org/745162
11 Signed-off-by: David Seifert <soap <AT> gentoo.org>
12
13 .../libxml2-2.10.3-python3-unicode-errors.patch | 35 ++++++++++++++++++++++
14 ...xml2-2.10.3.ebuild => libxml2-2.10.3-r1.ebuild} | 2 ++
15 2 files changed, 37 insertions(+)
16
17 diff --git a/dev-libs/libxml2/files/libxml2-2.10.3-python3-unicode-errors.patch b/dev-libs/libxml2/files/libxml2-2.10.3-python3-unicode-errors.patch
18 new file mode 100644
19 index 000000000000..525e1fe36c0b
20 --- /dev/null
21 +++ b/dev-libs/libxml2/files/libxml2-2.10.3-python3-unicode-errors.patch
22 @@ -0,0 +1,35 @@
23 +https://bugs.gentoo.org/745162
24 +https://gitlab.gnome.org/GNOME/libxml2/-/issues/64
25 +
26 +--- a/python/libxml.c
27 ++++ b/python/libxml.c
28 +@@ -1620,6 +1620,7 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
29 + PyObject *message;
30 + PyObject *result;
31 + char str[1000];
32 ++ unsigned char *ptr = (unsigned char *)str;
33 +
34 + #ifdef DEBUG_ERROR
35 + printf("libxml_xmlErrorFuncHandler(%p, %s, ...) called\n", ctx, msg);
36 +@@ -1636,12 +1637,20 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
37 + str[999] = 0;
38 + va_end(ap);
39 +
40 ++#if PY_MAJOR_VERSION >= 3
41 ++ /* Ensure the error string doesn't start at UTF8 continuation. */
42 ++ while (*ptr && (*ptr & 0xc0) == 0x80)
43 ++ ptr++;
44 ++#endif
45 ++
46 + list = PyTuple_New(2);
47 + PyTuple_SetItem(list, 0, libxml_xmlPythonErrorFuncCtxt);
48 + Py_XINCREF(libxml_xmlPythonErrorFuncCtxt);
49 +- message = libxml_charPtrConstWrap(str);
50 ++ message = libxml_charPtrConstWrap(ptr);
51 + PyTuple_SetItem(list, 1, message);
52 + result = PyEval_CallObject(libxml_xmlPythonErrorFuncHandler, list);
53 ++ /* Forget any errors caused in the error handler. */
54 ++ PyErr_Clear();
55 + Py_XDECREF(list);
56 + Py_XDECREF(result);
57 + }
58
59 diff --git a/dev-libs/libxml2/libxml2-2.10.3.ebuild b/dev-libs/libxml2/libxml2-2.10.3-r1.ebuild
60 similarity index 98%
61 rename from dev-libs/libxml2/libxml2-2.10.3.ebuild
62 rename to dev-libs/libxml2/libxml2-2.10.3-r1.ebuild
63 index 7b940b3948b0..bc2c968b0da6 100644
64 --- a/dev-libs/libxml2/libxml2-2.10.3.ebuild
65 +++ b/dev-libs/libxml2/libxml2-2.10.3-r1.ebuild
66 @@ -56,6 +56,8 @@ MULTILIB_CHOST_TOOLS=(
67 /usr/bin/xml2-config
68 )
69
70 +PATCHES=( "${FILESDIR}"/${PN}-2.10.3-python3-unicode-errors.patch )
71 +
72 DOCS=( NEWS README.md TODO TODO_SCHEMAS python/TODO )
73
74 src_unpack() {