GNU bug report logs - #42680
[PATCH] gnu: emacs: Ignore empty XIM styles.

Previous Next

Package: guix-patches;

Reported by: Leo Prikler <leo.prikler <at> student.tugraz.at>

Date: Sun, 2 Aug 2020 18:50:02 UTC

Severity: normal

Tags: patch

Done: Mathieu Othacehe <othacehe <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 42680 in the body.
You can then email your comments to 42680 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#42680; Package guix-patches. (Sun, 02 Aug 2020 18:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo Prikler <leo.prikler <at> student.tugraz.at>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 02 Aug 2020 18:50:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: emacs: Ignore empty XIM styles.
Date: Sun,  2 Aug 2020 20:46:58 +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.
---
 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




Information forwarded to guix-patches <at> gnu.org:
bug#42680; Package guix-patches. (Mon, 03 Aug 2020 07:22:01 GMT) Full text and rfc822 format available.

Message #8 received at 42680 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Leo Prikler <leo.prikler <at> student.tugraz.at>
Cc: 42680 <at> debbugs.gnu.org
Subject: Re: [bug#42680] [PATCH] gnu: emacs: Ignore empty XIM styles.
Date: Mon, 03 Aug 2020 09:21:03 +0200
Hey Leo,

>                                         "emacs-fix-scheme-indent-function.patch"
> +                                       "emacs-ignore-empty-xim-styles.patch"
>                                         "emacs-source-date-epoch.patch"))

This patch looks fine, thanks! Did you report this issue upstream?

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#42680; Package guix-patches. (Mon, 03 Aug 2020 09:36:01 GMT) Full text and rfc822 format available.

Message #11 received at 42680 <at> debbugs.gnu.org (full text, mbox):

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: 42680 <at> debbugs.gnu.org
Subject: Re: [bug#42680] [PATCH] gnu: emacs: Ignore empty XIM styles.
Date: Mon, 03 Aug 2020 11:35:13 +0200
Am Montag, den 03.08.2020, 09:21 +0200 schrieb Mathieu Othacehe:
> Hey Leo,
> 
> >                                         "emacs-fix-scheme-indent-
> > function.patch"
> > +                                       "emacs-ignore-empty-xim-
> > styles.patch"
> >                                         "emacs-source-date-
> > epoch.patch"))
> 
> This patch looks fine, thanks! Did you report this issue upstream?
> 
> Mathieu
I have now, it's #42694.





Reply sent to Mathieu Othacehe <othacehe <at> gnu.org>:
You have taken responsibility. (Mon, 03 Aug 2020 10:41:01 GMT) Full text and rfc822 format available.

Notification sent to Leo Prikler <leo.prikler <at> student.tugraz.at>:
bug acknowledged by developer. (Mon, 03 Aug 2020 10:41:01 GMT) Full text and rfc822 format available.

Message #16 received at 42680-done <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Leo Prikler <leo.prikler <at> student.tugraz.at>
Cc: 42680-done <at> debbugs.gnu.org
Subject: Re: [bug#42680] [PATCH] gnu: emacs: Ignore empty XIM styles.
Date: Mon, 03 Aug 2020 12:40:07 +0200
>> This patch looks fine, thanks! Did you report this issue upstream?
>> 
>> Mathieu
> I have now, it's #42694.

Great, patch pushed with a reference to the proposed fix.

Thanks,

Mathieu





Information forwarded to guix-patches <at> gnu.org:
bug#42680; Package guix-patches. (Mon, 03 Aug 2020 14:52:01 GMT) Full text and rfc822 format available.

Message #19 received at 42680 <at> debbugs.gnu.org (full text, mbox):

From: Leo Prikler <leo.prikler <at> student.tugraz.at>
To: 42680 <at> debbugs.gnu.org
Subject: Fwd: Re: bug#42694: 26.3; Emacs crashes when linked against newer
 libx11
Date: Mon, 03 Aug 2020 16:51:14 +0200
[Message part 1 (text/plain, inline)]
It turns out, that this bug got fixed upstream independently using a
slightly different patch.
[Message part 2 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Leo Prikler <leo.prikler <at> student.tugraz.at>
Cc: 42694 <at> debbugs.gnu.org
Subject: Re: bug#42694: 26.3; Emacs crashes when linked against newer libx11
Date: Mon, 03 Aug 2020 17:40:41 +0300
> From: Leo Prikler <leo.prikler <at> student.tugraz.at>
> Date: Mon, 03 Aug 2020 11:31:49 +0200
> 
> Two days ago, a patch was sent to Guix updating libx11 to a newer
> version in order to fix CVE-2020-14344.  This causes a segmentation
> fault in Emacs when trying to start an X window.  After invoking GDB, I
> found the offending line to be:
> 
>   /* Determine XIC style */
>   xic_style = best_xim_style (FRAME_X_XIM_STYLES (f));
> 
> For some reason, FRAME_X_XIM_STYLES (f) returns NULL here and
> best_xim_style fails when ARRAYELTS is called on it.  I've attached a
> patch, that checks for this case.

Thanks, this is bug#42676, which was solved yesterday.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 01 Sep 2020 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 353 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.