unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: "Gerd Möllmann" <gerd.moellmann@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, 66743@debbugs.gnu.org
Subject: bug#66743: 30.0.50; Crash when dumping reftex
Date: Thu, 26 Oct 2023 09:38:40 +0000	[thread overview]
Message-ID: <87a5s5d8pr.fsf@localhost> (raw)
In-Reply-To: <m2ttqd3lx6.fsf@Pro.fritz.box>

[-- Attachment #1: Type: text/plain, Size: 1427 bytes --]

Gerd Möllmann <gerd.moellmann@gmail.com> writes:

>>> Emacs is always dumped with a few buffers, because temacs needs them
>>> to do the dumping.  See this comment text from buffer.c:
>>>
>>> 	 Implementation notes: the buffers we carry from temacs are:
>>> 	 " prin1", "*scratch*", " *Minibuf-0*", "*Messages*", and
>>> 	 " *code-conversion-work*".  They are created by
>>> 	 init_buffer_once and init_window_once (which are not called
>>> 	 in the dumped Emacs), and by the first call to coding.c
>>> 	 routines.
>>
>> Thanks.
>>
>> So, one idea would be to try and move the creation of these buffers from
>> the init_*_once functions to the "normal" init functions, and see what
>> happens. One would also have to take a closer look at coding.c, of course.
>
> Actually, this is bug#59029, sort of.
>
> TLDR is that the code to dump itrees is there, somewhere in git, but has
> an infinite recursion bug. So, I guess it should first be tried to
> revive that code and fix it (tests should also exist, IIUC).

While I agree that dumping buffer overlays would be nice to have, I
think I found a simple workaround for the specific issue I reported.
We may simply make sure that the overlays do not belong to any buffer -
it is good enough for the purposes of reftex library, where the overlay
objects are created once and then modified by side effect for actual
use.

See the attached patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-textmodes-reftex.el-Work-around-pdumper-crash-b.patch --]
[-- Type: text/x-patch, Size: 1709 bytes --]

From 3bc99957796a8e8f92c8cb57d7102ee0461b3d86 Mon Sep 17 00:00:00 2001
Message-ID: <3bc99957796a8e8f92c8cb57d7102ee0461b3d86.1698313010.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Thu, 26 Oct 2023 12:34:58 +0300
Subject: [PATCH] * lisp/textmodes/reftex.el: Work around pdumper crash
 (bug#66743)

(reftex-highlight-overlays): Make sure that the overlays objects are
not assigned to any buffer.  This is to work around pdumping not
supporting dumping buffer overlays (yet).
---
 lisp/textmodes/reftex.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index 0a1fa8580d0..5f564b7f9eb 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -2075,13 +2075,15 @@ 'reftex-delete-overlay
 (defvar reftex-highlight-overlays [nil nil nil])
 
 ;; Initialize the overlays
-(aset reftex-highlight-overlays 0 (make-overlay 1 1))
+;; Ensure that the overlays are not assigned to any buffer to avoid
+;; crashing pdumper, if it is used to dump this library.  See bug#66743.
+(aset reftex-highlight-overlays 0 (with-temp-buffer (make-overlay 1 1)))
 (overlay-put (aref reftex-highlight-overlays 0)
              'face 'highlight)
-(aset reftex-highlight-overlays 1 (make-overlay 1 1))
+(aset reftex-highlight-overlays 1 (with-temp-buffer (make-overlay 1 1)))
 (overlay-put (aref reftex-highlight-overlays 1)
              'face reftex-cursor-selected-face)
-(aset reftex-highlight-overlays 2 (make-overlay 1 1))
+(aset reftex-highlight-overlays 2 (with-temp-buffer (make-overlay 1 1)))
 (overlay-put (aref reftex-highlight-overlays 2)
              'face reftex-cursor-selected-face)
 
-- 
2.42.0


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

  parent reply	other threads:[~2023-10-26  9:38 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-25  9:46 bug#66743: 30.0.50; Crash when dumping reftex Ihor Radchenko
2023-10-25 12:46 ` Eli Zaretskii
2023-10-25 12:58   ` Ihor Radchenko
2023-10-25 14:44     ` Stefan Kangas
2023-10-26  9:31       ` Ihor Radchenko
2023-10-26 10:01         ` Gerd Möllmann
2023-10-26 11:55           ` Ihor Radchenko
2023-10-26 12:08             ` Eli Zaretskii
2023-10-26 12:14               ` Ihor Radchenko
2023-10-26 13:04                 ` Eli Zaretskii
2023-10-26 13:13                   ` Ihor Radchenko
2023-10-26 13:18                     ` Eli Zaretskii
2023-10-26 13:27                       ` Ihor Radchenko
2023-10-26 13:28                         ` Eli Zaretskii
2023-10-26 13:48                           ` Ihor Radchenko
2023-10-26 15:49                             ` Eli Zaretskii
2023-10-27  9:08                               ` Ihor Radchenko
2023-10-27 10:38                                 ` Eli Zaretskii
2023-10-27 10:55                                   ` Ihor Radchenko
2023-10-27 11:01                                     ` Eli Zaretskii
2023-10-27 11:09                                       ` Ihor Radchenko
2023-10-27 12:36                                         ` Eli Zaretskii
2023-10-27 12:45                                           ` Ihor Radchenko
2023-10-27 12:53                                             ` Eli Zaretskii
2023-10-25 16:15     ` Gerd Möllmann
2023-10-25 16:21       ` Eli Zaretskii
2023-10-25 16:37         ` Gerd Möllmann
2023-10-26  7:03           ` Gerd Möllmann
2023-10-26  7:35             ` Eli Zaretskii
2023-10-26  8:04               ` Gerd Möllmann
2023-10-26  9:38             ` Ihor Radchenko [this message]
2023-10-26  9:44               ` Eli Zaretskii

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://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a5s5d8pr.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=66743@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gerd.moellmann@gmail.com \
    /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/emacs.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).