From: Alan Mackenzie <acm@muc.de>
To: 61847@debbugs.gnu.org
Cc: Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#61847: debug-early-backtrace only works some of the time.
Date: Mon, 27 Feb 2023 17:11:51 +0000 [thread overview]
Message-ID: <Y/zkV9FyVFzHr09+@ACM> (raw)
Hello, Emacs.
In the master branch:
Sometimes, instead of outputting a backtrace, debug-early throws an
error, like the second line of:
Error: cl-assertion-failed ((stringp typename))
Symbol's function definition is void: cl-defgeneric
.. To reproduce this failure, apply the following patch to src/eval.c,
then attempt a make bootstrap:
diff --git a/src/eval.c b/src/eval.c
index d42f7ffe894..8a88f5894b1 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -542,13 +542,13 @@ DEFUN ("function", Ffunction, Sfunction, 1, UNEVALLED, 0,
&& (EQ (QCdocumentation, XCAR (tmp))))
{ /* Handle the special (:documentation <form>) to build the docstring
dynamically. */
- Lisp_Object docstring = eval_sub (Fcar (XCDR (tmp)));
- if (SYMBOLP (docstring) && !NILP (docstring))
- /* Hack for OClosures: Allow the docstring to be a symbol
- * (the OClosure's type). */
- docstring = Fsymbol_name (docstring);
- CHECK_STRING (docstring);
- cdr = Fcons (XCAR (cdr), Fcons (docstring, XCDR (XCDR (cdr))));
+ /* Lisp_Object docstring = eval_sub (Fcar (XCDR (tmp))); */
+ /* if (SYMBOLP (docstring) && !NILP (docstring)) */
+ /* /\* Hack for OClosures: Allow the docstring to be a symbol */
+ /* * (the OClosure's type). *\/ */
+ /* docstring = Fsymbol_name (docstring); */
+ /* CHECK_STRING (docstring); */
+ /* cdr = Fcons (XCAR (cdr), Fcons (docstring, XCDR (XCDR (cdr)))); */
}
if (NILP (Vinternal_make_interpreted_closure_function))
return Fcons (Qclosure, Fcons (Vinternal_interpreter_environment, cdr));
..
The cause of the problem was patch
commit 08108a856a544a80d11b1e9e437fe6c45e25adec
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Date: Fri Apr 29 22:18:09 2022 -0400
debug-early: Print bytecode in a more manageable way
* lisp/emacs-lisp/debug-early.el (debug-early-backtrace):
Escape newlines to and bytecodes to make backtraces slightly more
readable. Use `cl-prin1` when available.
, which made debug-early.el dependent on arbitrarily nested Lisp code, in
violation of its explicitly stated design goal to have _no_ dependence on
Lisp code. Some of this Lisp simply fails to load. It's not clear why
the patch was applied.
I propose fixing the bug by restoring the code to having no such
dependencies with the following patch:
diff --git a/lisp/emacs-lisp/debug-early.el b/lisp/emacs-lisp/debug-early.el
index 395498f2206..723269f3ea0 100644
--- a/lisp/emacs-lisp/debug-early.el
+++ b/lisp/emacs-lisp/debug-early.el
@@ -44,28 +44,21 @@ 'debug-early-backtrace
(princ "\n")
(let ((print-escape-newlines t)
(print-escape-control-characters t)
- (print-escape-nonascii t)
- (prin1 (if (and (fboundp 'cl-prin1)
- ;; If we're being called while
- ;; bootstrapping, we won't be able to load
- ;; cl-print.
- (require 'cl-print nil t))
- #'cl-prin1
- #'prin1)))
+ (print-escape-nonascii t))
(mapbacktrace
#'(lambda (evald func args _flags)
(let ((args args))
(if evald
(progn
(princ " ")
- (funcall prin1 func)
+ (prin1 func)
(princ "("))
(progn
(princ " (")
(setq args (cons func args))))
(if args
(while (progn
- (funcall prin1 (car args))
+ (prin1 (car args))
(setq args (cdr args)))
(princ " ")))
(princ ")\n")))))))
.. Any objections to applying this patch?
--
Alan Mackenzie (Nuremberg, Germany).
next reply other threads:[~2023-02-27 17:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-27 17:11 Alan Mackenzie [this message]
2023-02-27 19:15 ` bug#61847: debug-early-backtrace only works some of the time Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-28 9:12 ` Alan Mackenzie
2023-02-28 12:16 ` Eli Zaretskii
2023-02-28 13:16 ` Alan Mackenzie
2023-02-28 14:22 ` Eli Zaretskii
2023-02-28 14:45 ` Alan Mackenzie
2023-02-28 17:36 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-28 19:52 ` Alan Mackenzie
2023-02-28 19:58 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-01 12:16 ` Eli Zaretskii
2023-03-01 15:22 ` Alan Mackenzie
2023-03-01 16:01 ` Eli Zaretskii
2023-03-01 16:46 ` Alan Mackenzie
2023-03-01 17:04 ` Eli Zaretskii
2023-03-01 17:31 ` Alan Mackenzie
2023-03-01 18:22 ` Eli Zaretskii
2023-03-01 17:34 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-03 10:58 ` Alan Mackenzie
2023-03-01 13:32 ` Eli Zaretskii
2023-03-01 16:05 ` Alan Mackenzie
2023-03-01 16:53 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y/zkV9FyVFzHr09+@ACM \
--to=acm@muc.de \
--cc=61847@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.