From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61847: debug-early-backtrace only works some of the time. Date: Mon, 27 Feb 2023 14:15:22 -0500 Message-ID: References: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="32965"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 61847@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 27 20:16:24 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pWiz1-0008Om-P9 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Feb 2023 20:16:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWiys-0006RD-5v; Mon, 27 Feb 2023 14:16:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pWiyi-0006Js-3j for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2023 14:16:05 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWiyg-0008Rc-6g for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2023 14:16:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pWiyg-0006GT-0j for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2023 14:16:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Feb 2023 19:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61847 X-GNU-PR-Package: emacs Original-Received: via spool by 61847-submit@debbugs.gnu.org id=B61847.167752533324034 (code B ref 61847); Mon, 27 Feb 2023 19:16:01 +0000 Original-Received: (at 61847) by debbugs.gnu.org; 27 Feb 2023 19:15:33 +0000 Original-Received: from localhost ([127.0.0.1]:48847 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWiyD-0006Fa-Ec for submit@debbugs.gnu.org; Mon, 27 Feb 2023 14:15:33 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:59560) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWiyB-0006FK-AP for 61847@debbugs.gnu.org; Mon, 27 Feb 2023 14:15:32 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 823D31000C4; Mon, 27 Feb 2023 14:15:25 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A9D1910002A; Mon, 27 Feb 2023 14:15:23 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1677525323; bh=U4pS5s62WzXYVF7o5sLMDHf8oFxwbklrmzj8IcUXVAk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=MsNyoKYAomV0xDf/Y1AfVAMZ7j/Ee19CsXedZnNGJsXrMUVdRvwOnw1grwEypBiie 27dMVfm43o0jhkUJByAJha1nUgTGp2CDeJ5p5D7GmA41zuWIjNxABRqpsJC1klxyio Fii05L48m28qKyNy8snipspL6KyCBwI7LQqJx3aE2Hs9eB3D7HocZe3pSCKYZJ36fR ZxSr65hnhXTbvPRh7YXVx8Uu/EFHzcu7KoxUSfBl0L47jo1ziJU2nj4kUlPuH37I9o ETsRjqFfK10CZAVn7o7MZmhMqKQrNCUzyllW1MjdvmRWsZEp6B5X4Gmm7GhmdAfE0r s3hLCkNz54iYg== Original-Received: from pastel (unknown [216.154.34.24]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 62660121C5C; Mon, 27 Feb 2023 14:15:23 -0500 (EST) In-Reply-To: (Alan Mackenzie's message of "Mon, 27 Feb 2023 17:11:51 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:256902 Archived-At: > The cause of the problem was patch > > commit 08108a856a544a80d11b1e9e437fe6c45e25adec > Author: Stefan Monnier > 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. Indeed (fboundp 'cl-prin1) was too optimistic a test since it just checks whether we're before loading `loaddef.el` or after it, but `cl-prin1` uses more (preloaded) features such as those provided by `cl-generic` which is only loaded later. > It's not clear why the patch was applied. To get more readable backtraces when used after bootstrapping (as well as in the later phases of bootstrapping). > I propose fixing the bug by restoring the code to having no such > dependencies with the following patch: How 'bout the patch below instead. Maybe we should instead try and check whether we're after the bootstrap (not sure what would be the corresponding test). Stefan diff --git a/lisp/emacs-lisp/debug-early.el b/lisp/emacs-lisp/debug-early.el index 395498f2206..65770a9c1d9 100644 --- a/lisp/emacs-lisp/debug-early.el +++ b/lisp/emacs-lisp/debug-early.el @@ -46,10 +46,13 @@ 'debug-early-backtrace (print-escape-control-characters t) (print-escape-nonascii t) (prin1 (if (and (fboundp 'cl-prin1) + (fboundp 'cl-defmethod) ;; If we're being called while ;; bootstrapping, we won't be able to load ;; cl-print. - (require 'cl-print nil t)) + (condition-case nil + (require 'cl-print nil t) + (error nil))) #'cl-prin1 #'prin1))) (mapbacktrace