From: Leo Prikler <leo.prikler@student.tugraz.at>
To: 42680@debbugs.gnu.org
Subject: [bug#42680] [PATCH] gnu: emacs: Ignore empty XIM styles.
Date: Sun, 2 Aug 2020 20:46:58 +0200 [thread overview]
Message-ID: <20200802184655.30348-1-leo.prikler@student.tugraz.at> (raw)
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.
---
gnu/local.mk | 1 +
gnu/packages/emacs.scm | 2 ++
.../emacs-ignore-empty-xim-styles.patch | 21 +++++++++++++++++++
3 files changed, 24 insertions(+)
create mode 100644 gnu/packages/patches/emacs-ignore-empty-xim-styles.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index 9d295267a8..0144965827 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -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 \
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 8fe5750791..ad8d4b0606 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -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
index 0000000000..936b7a81f7
--- /dev/null
+++ b/gnu/packages/patches/emacs-ignore-empty-xim-styles.patch
@@ -0,0 +1,21 @@
+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;
+ }
--
2.28.0
next reply other threads:[~2020-08-02 18:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <837dufbxna.fsf@gnu.org>
2020-08-02 18:46 ` Leo Prikler [this message]
2020-08-03 7:21 ` [bug#42680] [PATCH] gnu: emacs: Ignore empty XIM styles Mathieu Othacehe
2020-08-03 9:35 ` Leo Prikler
2020-08-03 10:40 ` bug#42680: " Mathieu Othacehe
2020-08-03 14:51 ` [bug#42680] Fwd: Re: bug#42694: 26.3; Emacs crashes when linked against newer libx11 Leo Prikler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200802184655.30348-1-leo.prikler@student.tugraz.at \
--to=leo.prikler@student.tugraz.at \
--cc=42680@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).