aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/python-libxml2-utf8.patch
blob: e39672faa1b96c015f273885c221f2483a371399 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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 <https://bugzilla.opensuse.org/show_bug.cgi?id=1065270>.

--- 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);
     }
emove call-with-savepoint and associated code.Christopher Baines While care does need to be taken with making updates or inserts to the ValidPaths table, I think that trying to ensure this within update-or-insert is the wrong approach. Instead, when working with the store database, only one connection should be used to make changes to the database and those changes should happen in transactions that ideally begin immediately. This reverts commit 37545de4a3bf59611c184b31506fe9a16abe4c8b. * .dir-locals.el (scheme-mode): Remove entries for call-with-savepoint and call-with-retrying-savepoint. * guix/store/database.scm (call-with-savepoint, call-with-retrying-savepoint): Remove procedures. (update-or-insert): Remove use of call-with-savepoint. Change-Id: I2f986e8623d8235a90c40d5f219c1292c1ab157b 2023-10-20.dir-locals.el: Adjust indentation rule for ‘test-assertm’.Ludovic Courtès This reverts commit 92755c6352fd967bc74d8e5354aad057d779b717, which, at the time, was correct for the 3-argument ‘test-assertm’ macro in ‘tests/pack.scm’ but incorrect for the 2-argument variant found in other test files. * .dir-locals.el: Decrease argument count for ‘test-assertm’. 2023-09-17.dir-locals.el: Update bug-reference configuration and document it.Maxim Cournoyer (nil) <bug-reference-url-format>: Update URL. Add comment. * doc/contributing.texi (The Perfect Setup): New "Viewing bugs within Emacs" subsection. Co-authored-by: Brian Cully <bjc@spork.org> 2023-09-06.dir-locals: Streamline Geiser configuration.Maxim Cournoyer Geiser now has support locating the project root and adding it to the load path without external help; leverage it. * .dir-locals.el [nil]: Remove obsolete Geiser configuration. Set the geiser-repl-per-project-p variable to t. * doc/contributing.texi (The Perfect Setup): No longer mention explicitly setting the geiser-guile-load-path; instead mention the effect of the .dir-locals.el file. Reported-by: Wolf <wolf@wolfsden.cz> 2023-06-04records: Add MATCH-RECORD-LAMBDA.(unmatched-parenthesis ew syntax * guix/records.scm (match-record-lambda): New syntax. * tests/records.scm ("match-record-lambda"): New test. Signed-off-by: Josselin Poiret <dev@jpoiret.xyz> 2023-06-04dir-locals: Fix MATCH-RECORD indentation.(unmatched-parenthesis d * .dir-locals.el: Treat the fourth form onwards as the body, rather than the third onwards. Signed-off-by: Josselin Poiret <dev@jpoiret.xyz> 2023-03-17Revert gexp->derivation and computed-file indentation rules.Maxim Cournoyer This reverts b1c25e2ce364741d1c257d3bb3ab773032807a80 and partially reverts 82daab42811a2e3c7684ebdf12af75ff0fa67b99, which means the computed-file and gexp->derivation procedures are now indented as normal procedures. Rationale: see the discussion at https://lists.gnu.org/archive/html/guix-devel/2023-03/msg00008.html. In a nutshell: the convention is to use special rules for special forms (macros), not for procedures. * .dir-locals.el (scheme-mode): Remove the special indentation rules for the computed-file and gexp->derivation procedures. 2023-03-05.dir-locals.el: Allow Guix root-dir overrides when working via Tramp.Brian Cully * .dir-localsl.el: Add only the local part of the root directory to the guile search path. This lets you use Tramp to hack on a remote Guix checkout. Signed-off-by: Leo Famulari <leo@famulari.name> 2023-02-19.dir-locals: Add let-keywords indentation rules.Maxim Cournoyer * .dir-locals.el (scheme-mode): Add let-keywords indentation rules. 2023-02-02.dir-locals.el: Adjust indentation rule for test-assertm.Maxim Cournoyer * .dir-locals.el: Adjust the scheme-indent-function property for test-assertm, so that the two first arguments (the test name and the store variable) are indented as procedure arguments. 2023-02-02.dir-locals.el: Add indentation rule for computed-file.Maxim Cournoyer * .dir-locals.el: Configure scheme-indent-function property for computed-file, so that its first argument (the file name) is indented as a procedure argument. 2022-09-07.dir-locals.el: Update yas snippets directory.Andrew Tropin * .dir-locals.el (eval): Update yas snippets directory. 2022-09-05.dir-locals.el: Add .go to completion-ignored-extensions.Andrew Tropin * .dir-locals.el (eval): Add .go to completion-ignored-extensions. 2022-09-05.dir-locals.el: Add guix yasnippets.Andrew Tropin * .dir-locals.el (eval): Add guix yasnippets.