From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#65267: 30.0.50; modifying debug-ignored-errors during startup with --debug-init is broken Date: Thu, 17 Aug 2023 12:31:48 +0300 Message-ID: <83v8de581n.fsf@gnu.org> References: <20230813095429+0200.5928-stepnem@smrk.net> <20230813095429+0200.5928-stepnem@smrk.net> <20230813190826+0200.765169-stepnem@smrk.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19201"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 65267@debbugs.gnu.org, stepnem@smrk.net, npostavs@users.sourceforge.net To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 17 11:33:32 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 1qWZNk-0004nm-En for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 17 Aug 2023 11:33:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qWZMK-0001RR-7S; Thu, 17 Aug 2023 05:32:04 -0400 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 1qWZMI-0001NA-PK for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2023 05:32:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qWZMI-0002lf-GG for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2023 05:32:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qWZMI-0008U0-1c for bug-gnu-emacs@gnu.org; Thu, 17 Aug 2023 05:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 17 Aug 2023 09:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65267 X-GNU-PR-Package: emacs Original-Received: via spool by 65267-submit@debbugs.gnu.org id=B65267.169226471232593 (code B ref 65267); Thu, 17 Aug 2023 09:32:02 +0000 Original-Received: (at 65267) by debbugs.gnu.org; 17 Aug 2023 09:31:52 +0000 Original-Received: from localhost ([127.0.0.1]:42765 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWZM8-0008Td-AR for submit@debbugs.gnu.org; Thu, 17 Aug 2023 05:31:52 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33020) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qWZM5-0008TP-Pt for 65267@debbugs.gnu.org; Thu, 17 Aug 2023 05:31:50 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qWZLy-0002cq-Iu; Thu, 17 Aug 2023 05:31:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=W8XBYZ2KaUehA7ngGuTnWI2LUy909dTYIqvxAtbXN/Q=; b=IBLIW2Uwsqkw g4DhrOpdpA259dYFiH9OgEzGYTwGoKaCQAZ+cAfy/Xy0lV4hjzTmYGt43OwgHY4oZKRWB67yxZEno 1OLQkK+mVgb59X5C6GTftVvnDy7ZbeRhGHeBgsuUC7VTCW1ugf2Q23aQEs3Qa08Hd9WuSoBcN+6gW vWNLLBactlGwtamKPK9hs+yf4lvccq9zyJPSoIEaLlBPpICD7hZd6VBeMoqjjR/xhzWBfx80fyRrM U5Tbm7j/sxcERXn8gK4Fz1xbNjkbajhrL45zUvWmvqn50S5C01JU8bAMFCU1ZyibhI7JtuK6yhApw HAm3tnFEtVWm1lZU64M6ag==; In-Reply-To: (message from Stefan Monnier on Sun, 13 Aug 2023 15:47:33 -0400) 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:267647 Archived-At: > From: Stefan Monnier > Cc: Eli Zaretskii , 65267@debbugs.gnu.org, > Noam Postavsky > Date: Sun, 13 Aug 2023 15:47:33 -0400 > > [ Added Noam, since we're mentioning a problem linked to yasnippet.el. ] > > >> Yeah, it's wrong, but I'm not sure how to fix it: > >> `--debug-init` needs to change the value of `debug-ignored-errors` while > >> `init.el` is executed, > > > > FWIW, I'm sure I'm missing something, but the above is far from obvious > > to me. Why does --debug-init need to muck with debug-ignored-errors at > > all? debug-ignored-errors usually/mostly contains errors unlikely to > > occur during startup, > > "unlikely" doesn't mean they should be ignored: `debug-ignored-errors` > is for errors which should not bring up a debugger if they occur in > interactive use, but they're still errors, and if they occur during > `init.el` they are definitely not ignored: they stop the processing of > `init.el`. So when debugging init errors, we *should* bring up the > debugger for them. > > >> Maybe we should introduce a new `inhibit-debug-ignored-errors` which we > >> could let-bind while loading `init.el` without having to modify > >> `debug-ignored-errors` itself? > > > > If ignoring debug-ignored-errors during startup is really necessary, > > that sounds like a possibly cleaner way, indeed > > .. > > > (albeit introducing yet another form to ignore another form ignoring > > errors...). > > Yes, that's what's making me hesitate. What about the minor changes below? They do seem to yield the expected results in the original recipe. The idea is to detect the situation where the init file _added_ to the value of debug-ignored-errors, and re-add the additions after loading the init file. diff --git a/lisp/startup.el b/lisp/startup.el index 43d6bf7..4d0e59b 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1023,6 +1023,7 @@ startup--load-user-init-file ;; Use (startup--witness) instead of nil, so we can detect when the ;; init files set `debug-ignored-errors' to nil. (if init-file-debug '(startup--witness) debug-ignored-errors)) + (d-i-e-standard debug-ignored-errors) ;; The init file might contain byte-code with embedded NULs, ;; which can cause problems when read back, so disable nul ;; byte detection. (Bug#52554) @@ -1111,8 +1112,16 @@ startup--load-user-init-file ;; If we can tell that the init file altered debug-on-error, ;; arrange to preserve the value that it set up. - (or (eq debug-ignored-errors d-i-e-initial) - (setq d-i-e-from-init-file (list debug-ignored-errors))) + (unless (eq debug-ignored-errors d-i-e-initial) + (if (memq 'startup--witness debug-ignored-errors) + ;; The init file wants to add errors to the standard + ;; value, so we need to emulate that. + (setq d-i-e-from-init-file + (list (append d-i-e-standard + (remq 'startup--witness + debug-ignored-errors)))) + ;; The init file _replaces_ the standard value. + (setq d-i-e-from-init-file (list debug-ignored-errors)))) (or (eq debug-on-error debug-on-error-initial) (setq debug-on-error-should-be-set t debug-on-error-from-init-file debug-on-error)))