Received: (at 74294) by debbugs.gnu.org; 10 Nov 2024 18:38:38 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 10 13:38:37 2024 Received: from localhost ([127.0.0.1]:56581 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tACpZ-0007OL-Fg for submit <at> debbugs.gnu.org; Sun, 10 Nov 2024 13:38:37 -0500 Received: from mail.muc.de ([193.149.48.3]:37743) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <acm@HIDDEN>) id 1tACpW-0007O7-FA for 74294 <at> debbugs.gnu.org; Sun, 10 Nov 2024 13:38:36 -0500 Received: (qmail 13294 invoked by uid 3782); 10 Nov 2024 19:38:27 +0100 Received: from muc.de (pd953a71d.dip0.t-ipconnect.de [217.83.167.29]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 10 Nov 2024 19:38:27 +0100 Received: (qmail 22115 invoked by uid 1000); 10 Nov 2024 18:38:27 -0000 Date: Sun, 10 Nov 2024 18:38:26 +0000 To: Stefan Monnier <monnier@HIDDEN> Subject: Re: bug#74294: Master: debug-on-error is ineffective whilst requiring a file from the byte compiler. Message-ID: <ZzD9ogVKW9E4ilKY@HIDDEN> References: <ZzCvoEewfYAUy73l@HIDDEN> <jwvpln3vwa5.fsf-monnier+emacs@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <jwvpln3vwa5.fsf-monnier+emacs@HIDDEN> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie <acm@HIDDEN> X-Primary-Address: acm@HIDDEN X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 74294 Cc: acm@HIDDEN, 74294 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hello, Stefan. On Sun, Nov 10, 2024 at 12:31:46 -0500, Stefan Monnier wrote: > > Create the following files: > > 1: ~/test-byte-compile-errors.el: > > ######################################################################### > > ;; -*- lexical-binding:t -*- > > (require 'test-byte-compile-errors-2 "~/test-byte-compile-errors-2") > > ######################################################################### > > 2: ~/test-byte-compile-errors-2.el: > > ######################################################################### > > ;; -*- lexical-binding:t -*- > > (car 'baz) > > (provide 'test-byte-compile-errors-2) > > ######################################################################### > > (Note the erroneous (car 'baz) in this file.) > > (i) emacs -Q > > (ii) M-: (setq debug-on-error t) RET > > (iii) M-x byte-compile-file RET ~/test-byte-compile-errors.el RET > > (iv) The error message: > > test-byte-compile-errors.el:2:11: Error: Wrong type argument: listp, baz > > is displayed. The debugger is not run. This is surely a bug. > > (Note also, the file name displayed is not that where the error is: See > > bug#66912.) > > ######################################################################### > > Diagnosis > > --------- > > In the function bytecomp--displaying-warnings (bytecomp.el), a blocking > > condition-case is set up, except when byte-compile-debug is non-nil. > > This prevents the debugger running. The problem is, the effect of this > > condition-case prevails even outside the byte compiler whilst loading a > > file with `require'. > Hmm... whether it's "outside the byte compiler" or not is debatable. Well for sure, we're not processing functions beginning "byte-compile-" at the time. And perhaps most pertinently, an error in Fload doesn't (?can't be made to) invoke the byte compiler's error mechanism satisfactorally. > [ FWIW, I've been annoyed by the behavior as well, but just decided to set > `byte-compile-debug` to t in my init file, and life is bliss since then. ] That's fine for those who know about byte-compile-debug. I suspect the vast majority of users don't. And it's a hassle to have to run something THREE times to get a backtrace: The first time the error happens, the second time the user sets debug-on-error, then after considerable frustration and looking up of the elisp manual, the third time with byte-compile-debug set too. There might be an argument here for removing byte-compile-debug and that condition-case altogether, but that's not what I'm arguing at the moment. > > Set up one or more handler-binds around the parts of Fload that evaluate > > the contents of the file being loaded. In the event of an error, the > > handler-bind handler would trigger, test debug-on-error, and if it's set > > appropriately, call the debugger, then quit. Otherwise, the handler > > would return, and the error handling would eventually reach the > > condition-case set up by bytecomp--displaying-warnings. > Is the problem specific to `load`, really? Yes, I think it is. Because it is precisely during Fload called from the byte compiler when a signalled error gives no clue as to the source of that error. > What about errors within `eval-when-compile` or during the expansion of > one of the macros? Errors there will say where they have happened, more or less. > Also, do you really want to bring up the debugger in cases like > (eval-when-compile > (condition-case nil > (require ...) > (error ...))) > which I've seen used in a few packages out there? When debug-on-error is enabled, yes. To do everything the way we'd like, we don't have enough control levers. It is probably better to enter the debugger in the above case (the user did set debug-on-error after all) than not enter it when an error happens in a deep stack of `require's. > Stefan -- Alan Mackenzie (Nuremberg, Germany).
bug-gnu-emacs@HIDDEN
:bug#74294
; Package emacs
.
Full text available.Received: (at 74294) by debbugs.gnu.org; 10 Nov 2024 17:31:58 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 10 12:31:58 2024 Received: from localhost ([127.0.0.1]:56471 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tABn3-0004Q9-Np for submit <at> debbugs.gnu.org; Sun, 10 Nov 2024 12:31:58 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:20319) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <monnier@HIDDEN>) id 1tABn1-0004Pt-EW for 74294 <at> debbugs.gnu.org; Sun, 10 Nov 2024 12:31:56 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 12CC91001D9; Sun, 10 Nov 2024 12:31:49 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1731259908; bh=ngj2SB4gZDTRnpFX1RTq84s1L2yMnWgu1xe1r/mrSkg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Wr2u3SqdJBrojSo4uk/+iZcHNL4fvWYKLjLcYNxN9kHWfnboKEHnWLghc4n3mnTrA nEtHAFA28t1AJfvMPkSSWQ1Gt8nEcKeraVvCyD7j0Kxn66noWzOW++HvXvctw87WIy e9EtfyI0GLOtPb4xpCwFOUJBhX4psJmgiUzdXv0ZiwtZSRpBd+jYdIw2YEiSSLySz1 7qw4bebrgfgtd1w4twvbJ4ZQ0FRQ9NRW+oVVVysdXJlMj4lkGxbihuUnRlA7ITemzN QVmsgR66u3kqiZz7UASGl1aSYffD+34ehLI2OmjH5JIoozk8coFbYrYBMHmV6H9Q7a vEU8YdeJGRVDA== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 46A1C100180; Sun, 10 Nov 2024 12:31:48 -0500 (EST) Received: from pastel (104-195-225-43.cpe.teksavvy.com [104.195.225.43]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 1C1341202F2; Sun, 10 Nov 2024 12:31:48 -0500 (EST) From: Stefan Monnier <monnier@HIDDEN> To: Alan Mackenzie <acm@HIDDEN> Subject: Re: bug#74294: Master: debug-on-error is ineffective whilst requiring a file from the byte compiler. In-Reply-To: <ZzCvoEewfYAUy73l@HIDDEN> (Alan Mackenzie's message of "Sun, 10 Nov 2024 13:05:36 +0000") Message-ID: <jwvpln3vwa5.fsf-monnier+emacs@HIDDEN> References: <ZzCvoEewfYAUy73l@HIDDEN> Date: Sun, 10 Nov 2024 12:31:46 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.065 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 74294 Cc: 74294 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Create the following files: > > 1: ~/test-byte-compile-errors.el: > ######################################################################### > ;; -*- lexical-binding:t -*- > (require 'test-byte-compile-errors-2 "~/test-byte-compile-errors-2") > ######################################################################### > > 2: ~/test-byte-compile-errors-2.el: > ######################################################################### > ;; -*- lexical-binding:t -*- > (car 'baz) > > (provide 'test-byte-compile-errors-2) > ######################################################################### > > (Note the erroneous (car 'baz) in this file.) > > (i) emacs -Q > (ii) M-: (setq debug-on-error t) RET > (iii) M-x byte-compile-file RET ~/test-byte-compile-errors.el RET > > (iv) The error message: > > test-byte-compile-errors.el:2:11: Error: Wrong type argument: listp, baz > > is displayed. The debugger is not run. This is surely a bug. > > (Note also, the file name displayed is not that where the error is: See > bug#66912.) > > ######################################################################### > > Diagnosis > --------- > > In the function bytecomp--displaying-warnings (bytecomp.el), a blocking > condition-case is set up, except when byte-compile-debug is non-nil. > This prevents the debugger running. The problem is, the effect of this > condition-case prevails even outside the byte compiler whilst loading a > file with `require'. Hmm... whether it's "outside the byte compiler" or not is debatable. [ FWIW, I've been annoyed by the behavior as well, but just decided to set `byte-compile-debug` to t in my init file, and life is bliss since then. ] > Set up one or more handler-binds around the parts of Fload that evaluate > the contents of the file being loaded. In the event of an error, the > handler-bind handler would trigger, test debug-on-error, and if it's set > appropriately, call the debugger, then quit. Otherwise, the handler > would return, and the error handling would eventually reach the > condition-case set up by bytecomp--displaying-warnings. Is the problem specific to `load`, really? What about errors within `eval-when-compile` or during the expansion of one of the macros? Also, do you really want to bring up the debugger in cases like (eval-when-compile (condition-case nil (require ...) (error ...))) which I've seen used in a few packages out there? Stefan
bug-gnu-emacs@HIDDEN
:bug#74294
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 10 Nov 2024 13:05:50 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 10 08:05:50 2024 Received: from localhost ([127.0.0.1]:56117 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tA7dV-0000oq-Su for submit <at> debbugs.gnu.org; Sun, 10 Nov 2024 08:05:50 -0500 Received: from lists.gnu.org ([209.51.188.17]:36226) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <acm@HIDDEN>) id 1tA7dT-0000oi-N7 for submit <at> debbugs.gnu.org; Sun, 10 Nov 2024 08:05:48 -0500 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 <acm@HIDDEN>) id 1tA7dS-0000Ms-En for bug-gnu-emacs@HIDDEN; Sun, 10 Nov 2024 08:05:47 -0500 Received: from mail.muc.de ([193.149.48.3]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <acm@HIDDEN>) id 1tA7dO-00022v-DS for bug-gnu-emacs@HIDDEN; Sun, 10 Nov 2024 08:05:45 -0500 Received: (qmail 38180 invoked by uid 3782); 10 Nov 2024 14:05:37 +0100 Received: from muc.de (pd953a71d.dip0.t-ipconnect.de [217.83.167.29]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 10 Nov 2024 14:05:36 +0100 Received: (qmail 16004 invoked by uid 1000); 10 Nov 2024 13:05:36 -0000 Date: Sun, 10 Nov 2024 13:05:36 +0000 To: bug-gnu-emacs@HIDDEN Subject: Master: debug-on-error is ineffective whilst requiring a file from the byte compiler. Message-ID: <ZzCvoEewfYAUy73l@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Debbugs-Cc: Stefan Monnier <monnier@HIDDEN> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie <acm@HIDDEN> X-Primary-Address: acm@HIDDEN Received-SPF: pass client-ip=193.149.48.3; envelope-from=acm@HIDDEN; helo=mail.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.4 (--) Hello, Emacs. In master (any recent version): Create the following files: 1: ~/test-byte-compile-errors.el: ######################################################################### ;; -*- lexical-binding:t -*- (require 'test-byte-compile-errors-2 "~/test-byte-compile-errors-2") ######################################################################### 2: ~/test-byte-compile-errors-2.el: ######################################################################### ;; -*- lexical-binding:t -*- (car 'baz) (provide 'test-byte-compile-errors-2) ######################################################################### (Note the erroneous (car 'baz) in this file.) (i) emacs -Q (ii) M-: (setq debug-on-error t) RET (iii) M-x byte-compile-file RET ~/test-byte-compile-errors.el RET (iv) The error message: test-byte-compile-errors.el:2:11: Error: Wrong type argument: listp, baz is displayed. The debugger is not run. This is surely a bug. (Note also, the file name displayed is not that where the error is: See bug#66912.) ######################################################################### Diagnosis --------- In the function bytecomp--displaying-warnings (bytecomp.el), a blocking condition-case is set up, except when byte-compile-debug is non-nil. This prevents the debugger running. The problem is, the effect of this condition-case prevails even outside the byte compiler whilst loading a file with `require'. ######################################################################### Proposed Resolution ------------------- Set up one or more handler-binds around the parts of Fload that evaluate the contents of the file being loaded. In the event of an error, the handler-bind handler would trigger, test debug-on-error, and if it's set appropriately, call the debugger, then quit. Otherwise, the handler would return, and the error handling would eventually reach the condition-case set up by bytecomp--displaying-warnings. -- Alan Mackenzie (Nuremberg, Germany).
Alan Mackenzie <acm@HIDDEN>
:monnier@HIDDEN, bug-gnu-emacs@HIDDEN
.
Full text available.monnier@HIDDEN, bug-gnu-emacs@HIDDEN
:bug#74294
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.