This patch fixes a crash in the libxml2 bindings for Python 3.x that 'itstool' stumbles upon when processing UTF-8 data: https://issues.guix.gnu.org/issue/37468 Patch by Jan Matejek from . --- libxml2-2.9.5.orig/python/libxml.c +++ libxml2-2.9.5/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,12 +1637,20 @@ libxml_xmlErrorFuncHandler(ATTRIBUTE_UNU str[999] = 0; va_end(ap); +#if PY_MAJOR_VERSION >= 3 + /* Ensure the error string doesn't start at UTF8 continuation. */ + while (*ptr && (*ptr & 0xc0) == 0x80) + ptr++; +#endif + 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); + /* Forget any errors caused in the error handler. */ + PyErr_Clear(); Py_XDECREF(list); Py_XDECREF(result); } x/commit/gnu/installer/timezone.scm?id=006f9f0f21e12cdd29ae4758b778bb7ad831e291'>commitdiff
path: root/gnu/installer/timezone.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-11-14 20:11:47 +0100
committerLudovic Courtès <ludo@gnu.org>2023-11-15 11:36:21 +0100
commit006f9f0f21e12cdd29ae4758b778bb7ad831e291 (patch)
tree6ce3b0bbaa9b0cbc8ab091e4d536c399dc212eeb /gnu/installer/timezone.scm
parentaaee0e4af3809f8dbefb5d6efe251f0d73f8ed95 (diff)
downloadguix-006f9f0f21e12cdd29ae4758b778bb7ad831e291.tar.gz
guix-006f9f0f21e12cdd29ae4758b778bb7ad831e291.zip
gnu: spindle: Fix compilation with GCC 11.
* gnu/packages/admin.scm (spindle)[arguments]: Add CXXFLAGS to #:configure-flags. Change-Id: I660228b8839a524791273f3fc7b6935d704b6715
Diffstat (limited to 'gnu/installer/timezone.scm')
0 files changed, 0 insertions, 0 deletions