Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/libxml2/, dev-libs/libxml2/files/
Date: Thu, 03 Dec 2020 00:14:57
Message-Id: 1606954489.da4038c33b2c7684f5766d6e8f1d1089e863e87c.sam@gentoo
1 commit: da4038c33b2c7684f5766d6e8f1d1089e863e87c
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Thu Dec 3 00:13:24 2020 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Dec 3 00:14:49 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da4038c3
7
8 dev-libs/libxml2: restore itstool-segfault patch
9
10 We stopped applying this patch during a roll
11 of a new patchset (my fault), but it seems to still
12 be needed. Noticed when building some of MATE.
13
14 Bug: https://bugs.gentoo.org/745162
15 Package-Manager: Portage-3.0.9, Repoman-3.0.2
16 Signed-off-by: Sam James <sam <AT> gentoo.org>
17
18 .../libxml2-2.9.8-python3-unicode-errors.patch | 34 ++++++++++++++++++++++
19 ...2-2.9.10-r3.ebuild => libxml2-2.9.10-r4.ebuild} | 3 ++
20 2 files changed, 37 insertions(+)
21
22 diff --git a/dev-libs/libxml2/files/libxml2-2.9.8-python3-unicode-errors.patch b/dev-libs/libxml2/files/libxml2-2.9.8-python3-unicode-errors.patch
23 new file mode 100644
24 index 00000000000..e87dcdedf88
25 --- /dev/null
26 +++ b/dev-libs/libxml2/files/libxml2-2.9.8-python3-unicode-errors.patch
27 @@ -0,0 +1,34 @@
28 +Index: libxml2-2.9.5/python/libxml.c
29 +===================================================================
30 +--- libxml2-2.9.5.orig/python/libxml.c
31 ++++ libxml2-2.9.5/python/libxml.c
32 +@@ -1620,6 +1620,7 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
33 + PyObject *message;
34 + PyObject *result;
35 + char str[1000];
36 ++ unsigned char *ptr = (unsigned char *)str;
37 +
38 + #ifdef DEBUG_ERROR
39 + printf("libxml_xmlErrorFuncHandler(%p, %s, ...) called\n", ctx, msg);
40 +@@ -1636,12 +1637,20 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
41 + str[999] = 0;
42 + va_end(ap);
43 +
44 ++#if PY_MAJOR_VERSION >= 3
45 ++ /* Ensure the error string doesn't start at UTF8 continuation. */
46 ++ while (*ptr && (*ptr & 0xc0) == 0x80)
47 ++ ptr++;
48 ++#endif
49 ++
50 + list = PyTuple_New(2);
51 + PyTuple_SetItem(list, 0, libxml_xmlPythonErrorFuncCtxt);
52 + Py_XINCREF(libxml_xmlPythonErrorFuncCtxt);
53 +- message = libxml_charPtrConstWrap(str);
54 ++ message = libxml_charPtrConstWrap(ptr);
55 + PyTuple_SetItem(list, 1, message);
56 + result = PyEval_CallObject(libxml_xmlPythonErrorFuncHandler, list);
57 ++ /* Forget any errors caused in the error handler. */
58 ++ PyErr_Clear();
59 + Py_XDECREF(list);
60 + Py_XDECREF(result);
61 + }
62
63 diff --git a/dev-libs/libxml2/libxml2-2.9.10-r3.ebuild b/dev-libs/libxml2/libxml2-2.9.10-r4.ebuild
64 similarity index 98%
65 rename from dev-libs/libxml2/libxml2-2.9.10-r3.ebuild
66 rename to dev-libs/libxml2/libxml2-2.9.10-r4.ebuild
67 index 916abdd469c..a6678320ffe 100644
68 --- a/dev-libs/libxml2/libxml2-2.9.10-r3.ebuild
69 +++ b/dev-libs/libxml2/libxml2-2.9.10-r4.ebuild
70 @@ -93,6 +93,9 @@ src_prepare() {
71 # Fix python tests when building out of tree #565576
72 eapply "${FILESDIR}"/${PN}-2.9.8-out-of-tree-test.patch
73
74 + # bug #745162
75 + eapply "${FILESDIR}"/${PN}-2.9.8-python3-unicode-errors.patch
76 +
77 if [[ ${CHOST} == *-darwin* ]] ; then
78 # Avoid final linking arguments for python modules
79 sed -i -e '/PYTHON_LIBS/s/ldflags/libs/' configure.ac || die