pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/textproc



Module Name:    pkgsrc
Committed By:   gutteridge
Date:           Sat Jun 12 17:02:52 UTC 2021

Modified Files:
        pkgsrc/textproc/libxml2: distinfo
        pkgsrc/textproc/py-libxml2: Makefile
Added Files:
        pkgsrc/textproc/libxml2/patches: patch-python_libxml.c

Log Message:
py-libxml2: work around a problem in error handling

Restore part of a patch lost in the last libxml2 update which is still
relevant. Reapplying it fixes segfaults caused by itstool, e.g., when
building editors/pluma, which is PR pkg/56229 from Andrius V.

Quoting from wiz@'s original commit from Jan 9, 2019, which covers
everything else:

"In some cases, invalid UTF-8 strings were returned which caused
Python interpreter crashes. See

itstool/itstool#22

Use a variant of the patch that was used in Fedora.

Bump PKGREVISION."

Fedora is still carrying this patch as-is.

(Also, evidently distinfo was not regenerated properly after the last
update, so there's a diff applied to it unrelated to this change set.)


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 pkgsrc/textproc/libxml2/distinfo
cvs rdiff -u -r0 -r1.4 pkgsrc/textproc/libxml2/patches/patch-python_libxml.c
cvs rdiff -u -r1.68 -r1.69 pkgsrc/textproc/py-libxml2/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/textproc/libxml2/distinfo
diff -u pkgsrc/textproc/libxml2/distinfo:1.135 pkgsrc/textproc/libxml2/distinfo:1.136
--- pkgsrc/textproc/libxml2/distinfo:1.135      Sun May 23 19:31:47 2021
+++ pkgsrc/textproc/libxml2/distinfo    Sat Jun 12 17:02:51 2021
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.135 2021/05/23 19:31:47 nia Exp $
+$NetBSD: distinfo,v 1.136 2021/06/12 17:02:51 gutteridge Exp $
 
 SHA1 (libxml2-2.9.12.tar.gz) = 339fe5bb2a7d0c13f068c26d8f7cd194c13f9a2a
 RMD160 (libxml2-2.9.12.tar.gz) = 766b9460b9e62b8152f431747c30c88c868c0c7e
@@ -9,11 +9,8 @@ SHA1 (patch-catalog.c) = 34afe787f6012b4
 SHA1 (patch-configure) = f6e9f08377a537657df08deee17a5cc66c60b808
 SHA1 (patch-doc_examples_Makefile.in) = 4eede9719724f94402e850ee6d6043a74aaf62b2
 SHA1 (patch-encoding.c) = 62b3343f0a0ea51e3fb8eb693e495520eefb6ffd
-SHA1 (patch-parser.c) = 9dcda6b8bc71c1abb095fc2c840ac40c1ae04a33
-SHA1 (patch-python-types.c) = d3c93a1c68956bc7da4f81a8fcbf1e6bad580bef
-SHA1 (patch-python_libxml.c) = c092f10787be1bb43764cc0bef4ffd35bbe6ec94
+SHA1 (patch-python_libxml.c) = a8d89922589f51db99c2b8960b32d37ddda8a7a9
 SHA1 (patch-python_libxml.py) = 869a72ae5ba2e27e6d46552878890acb22337675
 SHA1 (patch-python_libxml2.py) = 209d105b0f3aedb834091390a7c6819705108e34
 SHA1 (patch-python_setup.py) = 7771fd02ee6779463f1d3321f099d7e6d19cd1b1
 SHA1 (patch-xmlcatalog.c) = d65b7e3be9694147e96ce4bb70a1739e2279ba81
-SHA1 (patch-xmlschemas.c) = edd5be08e7b19ab8e35412b854e95dedbb7befdd

Index: pkgsrc/textproc/py-libxml2/Makefile
diff -u pkgsrc/textproc/py-libxml2/Makefile:1.68 pkgsrc/textproc/py-libxml2/Makefile:1.69
--- pkgsrc/textproc/py-libxml2/Makefile:1.68    Sun May 23 19:31:47 2021
+++ pkgsrc/textproc/py-libxml2/Makefile Sat Jun 12 17:02:51 2021
@@ -1,8 +1,9 @@
-# $NetBSD: Makefile,v 1.68 2021/05/23 19:31:47 nia Exp $
+# $NetBSD: Makefile,v 1.69 2021/06/12 17:02:51 gutteridge Exp $
 
 .include "../../textproc/libxml2/Makefile.common"
 
 PKGNAME=       ${PYPKGPREFIX}-${DISTNAME}
+PKGREVISION=   1
 
 COMMENT=       Python wrapper for libxml2
 LICENSE=       modified-bsd

Added files:

Index: pkgsrc/textproc/libxml2/patches/patch-python_libxml.c
diff -u /dev/null pkgsrc/textproc/libxml2/patches/patch-python_libxml.c:1.4
--- /dev/null   Sat Jun 12 17:02:52 2021
+++ pkgsrc/textproc/libxml2/patches/patch-python_libxml.c       Sat Jun 12 17:02:51 2021
@@ -0,0 +1,32 @@
+$NetBSD: patch-python_libxml.c,v 1.4 2021/06/12 17:02:51 gutteridge Exp $
+
+Avoid returning invalid UTF-8 strings to Python.
+Based on https://bugzilla.opensuse.org/attachment.cgi?id=746044&action=edit
+Fixes https://github.com/itstool/itstool/issues/22
+
+--- python/libxml.c.orig       2016-06-07 10:04:14.000000000 +0000
++++ python/libxml.c
+@@ -1620,6 +1620,7 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
+     PyObject *message;
+     PyObject *result;
+     char str[1000];
++    unsigned char *ptr = (unsigned char *)str;
+ 
+ #ifdef DEBUG_ERROR
+     printf("libxml_xmlErrorFuncHandler(%p, %s, ...) called\n", ctx, msg);
+@@ -1636,10 +1637,14 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU
+           str[999] = 0;
+         va_end(ap);
+ 
++        /* Ensure the error string doesn't start at UTF8 continuation. */
++        while (*ptr && (*ptr & 0xc0) == 0x80)
++          ptr++;
++
+         list = PyTuple_New(2);
+         PyTuple_SetItem(list, 0, libxml_xmlPythonErrorFuncCtxt);
+         Py_XINCREF(libxml_xmlPythonErrorFuncCtxt);
+-        message = libxml_charPtrConstWrap(str);
++        message = libxml_charPtrConstWrap(ptr);
+         PyTuple_SetItem(list, 1, message);
+         result = PyEval_CallObject(libxml_xmlPythonErrorFuncHandler, list);
+         Py_XDECREF(list);



Home | Main Index | Thread Index | Old Index