gnu: emacs: Ignore empty XIM styles.
authorLeo Prikler <leo.prikler@student.tugraz.at>
Sun, 2 Aug 2020 18:46:58 +0000 (20:46 +0200)
committerMathieu Othacehe <othacehe@gnu.org>
Mon, 3 Aug 2020 10:26:02 +0000 (12:26 +0200)
As of libx11 version 1.6.10, xim may be NULL, which causes a segmentation
fault in the execution of ARRAYELTS.  As a cautionary measure, we
short-circuit this logic.

* gnu/packages/patches/emacs-ignore-empty-xim-styles.patch: New file.
* gnu/packages/emacs.scm (emacs emacs-next)[patches]: Use it.
* gnu/local.mk: Register it.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
gnu/local.mk
gnu/packages/emacs.scm
gnu/packages/patches/emacs-ignore-empty-xim-styles.patch [new file with mode: 0644]

index f1a6c6a..8be9bac 100644 (file)
@@ -917,6 +917,7 @@ dist_patch_DATA =                                           \
   %D%/packages/patches/emacs-exec-path.patch                   \
   %D%/packages/patches/emacs-exwm-fix-fullscreen-states.patch  \
   %D%/packages/patches/emacs-fix-scheme-indent-function.patch  \
+  %D%/packages/patches/emacs-ignore-empty-xim-styles.patch     \
   %D%/packages/patches/emacs-json-reformat-fix-tests.patch     \
   %D%/packages/patches/emacs-highlight-stages-add-gexp.patch   \
   %D%/packages/patches/emacs-hyperbole-toggle-messaging.patch  \
index 8fe5750..ad8d4b0 100644 (file)
@@ -85,6 +85,7 @@
                 "119ldpk7sgn9jlpyngv5y4z3i7bb8q3xp4p0qqi7i5nq39syd42d"))
               (patches (search-patches "emacs-exec-path.patch"
                                        "emacs-fix-scheme-indent-function.patch"
+                                       "emacs-ignore-empty-xim-styles.patch"
                                        "emacs-source-date-epoch.patch"))
               (modules '((guix build utils)))
               (snippet
@@ -261,6 +262,7 @@ languages.")
          (file-name (git-file-name name version))
          (patches (search-patches "emacs27-exec-path.patch"
                                   "emacs-fix-scheme-indent-function.patch"
+                                  "emacs-ignore-empty-xim-styles.patch"
                                   "emacs-source-date-epoch.patch"))
          (modules (origin-modules (package-source emacs)))
          ;; TODO: once the snippet for `emacs' is changed to not fail when
diff --git a/gnu/packages/patches/emacs-ignore-empty-xim-styles.patch b/gnu/packages/patches/emacs-ignore-empty-xim-styles.patch
new file mode 100644 (file)
index 0000000..606d3ec
--- /dev/null
@@ -0,0 +1,24 @@
+Fix contributed upstream here:
+https://debbugs.gnu.org/cgi/bugreport.cgi?bug=42694.
+
+Index: emacs-26.3/src/xfns.c
+===================================================================
+--- emacs-26.3.orig/src/xfns.c
++++ emacs-26.3/src/xfns.c
+@@ -2533,6 +2533,8 @@ xic_free_xfontset (struct frame *f)
+ static XIMStyle
+ best_xim_style (XIMStyles *xim)
+ {
++  if (xim == NULL) goto out;
++
+   int i, j;
+   int nr_supported = ARRAYELTS (supported_xim_styles);
+
+@@ -2541,6 +2543,7 @@ best_xim_style (XIMStyles *xim)
+       if (supported_xim_styles[i] == xim->supported_styles[j])
+       return supported_xim_styles[i];
+
++ out:
+   /* Return the default style.  */
+   return XIMPreeditNothing | XIMStatusNothing;
+ }