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#64163: 29.0.92; Syntactic errors in early init when --debug-init is on Date: Tue, 20 Jun 2023 13:07:46 -0400 Message-ID: References: <878rcf20l0.fsf@whxvd.name> <83y1ke5kn7.fsf@gnu.org> <83pm5q5dc3.fsf@gnu.org> 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="26543"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 64163@debbugs.gnu.org, iota@whxvd.name To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 20 19:08:33 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 1qBeqF-0006hk-NU for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 20 Jun 2023 19:08:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBepo-00013k-ES; Tue, 20 Jun 2023 13:08: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 1qBepm-000139-8R for bug-gnu-emacs@gnu.org; Tue, 20 Jun 2023 13:08:02 -0400 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 1qBepl-0001in-Vy for bug-gnu-emacs@gnu.org; Tue, 20 Jun 2023 13:08:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qBepl-0002f7-HQ for bug-gnu-emacs@gnu.org; Tue, 20 Jun 2023 13:08:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Jun 2023 17:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64163 X-GNU-PR-Package: emacs Original-Received: via spool by 64163-submit@debbugs.gnu.org id=B64163.168728087910224 (code B ref 64163); Tue, 20 Jun 2023 17:08:01 +0000 Original-Received: (at 64163) by debbugs.gnu.org; 20 Jun 2023 17:07:59 +0000 Original-Received: from localhost ([127.0.0.1]:59689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBepi-0002ep-TU for submit@debbugs.gnu.org; Tue, 20 Jun 2023 13:07:59 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:56947) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qBeph-0002eZ-Er for 64163@debbugs.gnu.org; Tue, 20 Jun 2023 13:07:57 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 3818880233; Tue, 20 Jun 2023 13:07:52 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id D4C968008E; Tue, 20 Jun 2023 13:07:46 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1687280866; bh=Gl/WuSjqS/U5PDO7ArhuiSgA9G7ZvdAUIpCI/Ypf2PM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=J4xsyyMham6K15PhWvPtejsJcfVVJ4y/og7stNbvUtIrs5Mfglk907Ns3idfbAQ5P O/yfUgOgiaJc/GySrPXKYWn5DsltqwewhFBTwWkSmYJIXJzP3D00NaMUgLDq+mowJb QQEhYIBFvwhHEPP/oRxR5VRSDmwUrwsGCsdcx/H40Wy37c+2PqsPtlwM5dSXTWV/Qq kW8G2YKilrGQLDAmb1lJT+Hd5JSPXohtjZdsuNfzjqNp/XUF/H4g0kW5SwGVzro1WD hvDT7vZxinZHZAeo1/o4GYcAhMGdM/gmDnt9hX0LT9GGP7zKdAe6PwFlFdjXPdxqmf xbIT5vRr5rpDA== Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B91231209BC; Tue, 20 Jun 2023 13:07:46 -0400 (EDT) In-Reply-To: <83pm5q5dc3.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 20 Jun 2023 19:05:16 +0300") 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:263773 Archived-At: >> IOW `--debug-init` should be the one that sets `debug-ignored-errors` to >> nil > > So you are saying it should be condition on init-file-debug being > non-nil? Yup. > Incidentally, do you happen to know the difference between that > variable having the value t and 'startup'? I'm not familiar with this code, no. AFAICT, `startup` is a special value for `debug-on-error-initial` rather than for `init-file-debug`. I expect this is intended to be a value to which noone would set `debug-on-error`, tho it would make sense to use a more verbose/unlikely value, both to better detect user settings of `debug-on-error` and to help document the code. Maybe something like the patch below (I also renamed the local variables so they don't look like global variables). Stefan diff --git a/lisp/startup.el b/lisp/startup.el index 835ad785af1..5b842055c58 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -1021,17 +1021,17 @@ startup--load-user-init-file This function sets `user-init-file' to the name of the loaded init-file, or to a default value if loading is not possible." - (let ((debug-on-error-from-init-file nil) - (debug-on-error-should-be-set nil) - (debug-on-error-initial - (if (eq init-file-debug t) - 'startup - init-file-debug)) + (let ((d-o-e-from-init-file nil) + (d-o-e-initial + (if init-file-debug 'startup--witness debug-on-error)) + (d-i-e-from-init-file nil) + (d-i-e-initial + (if init-file-debug '(startup--witness) 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) (inhibit-null-byte-detection t)) - (let ((debug-on-error debug-on-error-initial)) + (let ((debug-on-error d-o-e-initial)) (condition-case-unless-debug error (when init-file-user (let ((init-file-name (funcall filename-function))) @@ -1112,12 +1112,15 @@ 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-on-error debug-on-error-initial) - (setq debug-on-error-should-be-set t - debug-on-error-from-init-file debug-on-error))) - - (when debug-on-error-should-be-set - (setq debug-on-error debug-on-error-from-init-file)))) + (or (eq debug-on-error d-o-e-initial) + (setq d-o-e-from-init-file (list debug-on-error))) + (or (eq debug-ignored-errors d-i-e-initial) + (setq d-i-e-from-init-file (list debug-ignored-errors)))) + + (when d-o-e-from-init-file + (setq debug-on-error (car d-o-e-from-init-file))) + (when d-i-e-from-init-file + (setq debug-ignored-errors (car d-i-e-from-init-file))))) (defvar lisp-directory nil "Directory where Emacs's own *.el and *.elc Lisp files are installed.")