GNU bug report logs -
#56643
29.0.50; Help-mode bookmarks not loading with native compilation
Previous Next
Reported by: defun.foo <at> proton.me
Date: Tue, 19 Jul 2022 16:12:02 UTC
Severity: normal
Found in version 29.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Sat, 23 Jul 2022 12:57:49 +0300
with message-id <83leski21u.fsf <at> gnu.org>
and subject line Re: bug#56643: 29.0.50; Help-mode bookmarks not loading with native compilation
has caused the debbugs.gnu.org bug report #56643,
regarding 29.0.50; Help-mode bookmarks not loading with native compilation
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
56643: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56643
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
Overview:
With native compilation enabled, adding a bookmark in a help buffer seems to work normally for the duration of the Emacs session, but when Emacs is restarted an "Invalid read syntax: '#'" error is thrown and the entire bookmark list fails to load. This appears to be caused by a compiled lambda being serialized to the bookmark file in a way that is unreadable to the reader.
Emacs version:
29.0.5, compiled from latest master branch on 7-18-2022, and started with emacs -Q for both scenarios below.
Steps to reproduce:
1. Ensure that native compilation is enabled by running M-x native-comp-available-p
2. Run M-x describe-function {{any-function}} and move to the resulting *Help* buffer
3. Create a bookmark with C-x r m
4. Without quitting Emacs, kill the *Help* buffer, then run C-x r b to jump back to the bookmark (this works as expected)
5. Quit Emacs (C-x C-c), and restart
6. Attempt to jump to the same bookmark again (running C-x r b), and observe that the bookmark list fails to load and throws an "Invalid read syntax: '#'" error
Here is an example of a help bookmark as it was serialized to the bookmarks file (note the "help-fn" value):
("native-comp-bookmark"
(position . 1)
(last-modified 25301 49750 590832 312000)
(help-fn . #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_9>)
(help-args switch-to-buffer "*scratch*")
(position . 1)
(handler . help-bookmark-jump))
For comparison, I compiled Emacs without the native compilation flag (and verified that native-comp-available-p returned nil), and went through the same steps above, creating a new bookmark. Jumping back to the bookmark after restarting works as expected, and here is an example of that bookmark serialized without native comp:
("vanilla-bookmark"
(position . 1)
(last-modified 25301 49238 861856 736000)
(help-fn .
#[514 "\301!\205\0\211\302!)\207"
[describe-function-orig-buffer buffer-live-p describe-function]
4 "\n\n(fn FUNCTION BUFFER)"])
(help-args switch-to-buffer "*scratch*")
(position . 1)
(handler . help-bookmark-jump))
I did find an older similar bug (#24573 https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-09/msg00971.html) which was causing the same error due to a buffer object being serialized. This was fixed by saving just the buffer name, but I'm not sure there's any comparable way to save a reference to a compiled lambda. Any advice would be much appreciated though!
[Message part 3 (message/rfc822, inline)]
> Cc: michael_heerdegen <at> web.de, defun.foo <at> proton.me, 56643 <at> debbugs.gnu.org
> Date: Fri, 22 Jul 2022 17:40:48 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
>
> > > Thanks. If Andrea confirms that this won't have any problems with
> > > native-compilation, I will install such changes on the release branch
> > > (since AFAIU this issue is a regression in Emacs 28).
> >
> > I confirm it should just work.
>
> Thanks, so I will make those changes on the release branch.
Done.
> > BTW, I mention this for other similar cases, another fix would be to add
> > (declare (speed -1)) to `describe-function'.
>
> Thanks, good to know. I guess we should document that in the ELisp
> manual.
Also done.
Closing.
This bug report was last modified 2 years and 362 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.