From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 06 12:23:31 2025 Received: (at submit) by debbugs.gnu.org; 6 Mar 2025 17:23:31 +0000 Received: from localhost ([127.0.0.1]:45220 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tqEwU-0006xY-O9 for submit@debbugs.gnu.org; Thu, 06 Mar 2025 12:23:31 -0500 Received: from lists.gnu.org ([2001:470:142::17]:58060) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tqEwS-0006xM-Ks for submit@debbugs.gnu.org; Thu, 06 Mar 2025 12:23:28 -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 ) id 1tqEwL-0004jo-76 for bug-gnu-emacs@gnu.org; Thu, 06 Mar 2025 12:23:21 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tqEwJ-0002Kb-Nx for bug-gnu-emacs@gnu.org; Thu, 06 Mar 2025 12:23:20 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id F0738443060 for ; Thu, 6 Mar 2025 12:23:17 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1741281797; bh=HFQfRVjbKzQ6vFMHtM41D6socXqzc+bI5A4SQqc4LJc=; h=From:To:Subject:Date:From; b=FEcjMoP5sVX4ge0SZg25PHDQlfUa9dqEnf21YwcRahnIvOc048HB7QvARFQUGhVTk zsFV28j5AJKiURTEmteKNQmsDEtPOU/IBZqhNHjmFrTKsThDL4VgFAKOXiTR9n5zOn WbOvNV0EsLJEZbC3HkWLcifwxF0dfHAYNwvbwI7sOJGcyR5Din/iemMgm20MsVPg7u 4v+HRXuGWpOI2ROruQwZtVqYsXc9FwRJzFBTNvh/D3dlrmxecDbGgeeTsl9TUB05yf dqTHs4UIEAbxyQie/rAxYbNex3WOXOVJnAQlx9nF91FVRADeKiOP+eg8qbbKsglQLN Dop+TSWxOGtFg== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 0340044305E for ; Thu, 6 Mar 2025 12:23:17 -0500 (EST) Received: from alfajor (unknown [104.247.242.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id DA3FC12055D for ; Thu, 6 Mar 2025 12:23:16 -0500 (EST) From: Stefan Monnier To: bug-gnu-emacs@gnu.org Subject: 31.0.50; Double backtrace in batch mode Message-ID: X-Debbugs-Cc: monnier@iro.umontreal.ca Date: Thu, 06 Mar 2025 12:23:15 -0500 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.373 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: Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Package: Emacs Version: 31.0.50 Emacs in batch mode sometimes shows twice the same backtrace: % /usr/bin/emacs -Q --batch --eval '(setq debug-on-error t)' --eval '(error "foo")' Error: error ("foo") error("foo") eval((error "foo") t) command-line-1(("--eval" "(setq debug-on-error t)" "--eval" "(error \"foo\")")) command-line() normal-top-level() Debugger entered--Lisp error: (error "foo") error("foo") eval((error "foo") t) command-line-1(("--eval" "(setq debug-on-error t)" "--eval" "(error \"foo\")")) command-line() normal-top-level() % I think I'm in part to blame for this one. It seems that one of them comes from the "normal" debugger and the other from `debug-early--handler`. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Mar 06 15:26:53 2025 Received: (at 76787-done) by debbugs.gnu.org; 6 Mar 2025 20:26:53 +0000 Received: from localhost ([127.0.0.1]:45581 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tqHnw-0006qn-To for submit@debbugs.gnu.org; Thu, 06 Mar 2025 15:26:53 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:11286) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tqHnt-0006qU-Pb for 76787-done@debbugs.gnu.org; Thu, 06 Mar 2025 15:26:50 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id AB4CF80A48; Thu, 6 Mar 2025 15:26:42 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1741292801; bh=83QA4Y5R9YoqNA5vpBMEpZNM9c8G+lkMkzHMUOB+KjE=; h=From:To:Subject:In-Reply-To:References:Date:From; b=Auk2UQwgIGZsX9muWZUvbAIQcBbgd+MKwFSpU3NU/Zp/SjVQ3sVgmwiuW+PzNuI7B zMsIRmetXC7vJkTLYnIsNJ8nQEqbXhOwmJ3riNmGluICmVibVyoJRb5uGFWRSNF2x6 D06gWkTSX0LnfiPS5lLQ13+j+LoSRT3bHU3pM9n0nhMETp7QcYzBx4gEOBt4860iwX bybTY7p1N8dwGki0TmgSotVFQUobOedOygOimg3ogjFdS1/g+fdSxaYhJDtAUjGzSr nTX6PK5zk+5eF+HPoID2g4UdAp61A/k9Xy4V6AuQZ/y98dy/U0vD7PYYscQOvoqS3w LbFLKW+fRY6sw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id AEBDD802A9; Thu, 6 Mar 2025 15:26:41 -0500 (EST) Received: from alfajor (modemcable005.21-80-70.mc.videotron.ca [70.80.21.5]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8983512032C; Thu, 6 Mar 2025 15:26:41 -0500 (EST) From: Stefan Monnier To: 76787-done@debbugs.gnu.org Subject: Re: bug#76787: 31.0.50; Double backtrace in batch mode In-Reply-To: Message-ID: References: Date: Thu, 06 Mar 2025 15:26:40 -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.216 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: 76787-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > I think I'm in part to blame for this one. It seems that one of them > comes from the "normal" debugger and the other from > `debug-early--handler`. Rather than try and figure out how to coordinate the two places so they don't both call a debugger, I generalized the `debugger--last-error` mechanism with the patch below. Stefan diff --git a/lisp/emacs-lisp/debug-early.el b/lisp/emacs-lisp/debug-early.el index 48b71e7f9f0..e63edb19328 100644 --- a/lisp/emacs-lisp/debug-early.el +++ b/lisp/emacs-lisp/debug-early.el @@ -36,6 +36,8 @@ ;; For bootstrap reasons, we cannot use any macros here since they're ;; not defined yet. +(defvar debugger--last-error nil) + (defalias 'debug-early-backtrace #'(lambda (&optional base) "Print a trace of Lisp function calls currently active. @@ -76,15 +78,19 @@ 'debug-early-backtrace (setq args (cdr args))) (princ " "))) (princ ")\n")))) - base)))) + base)) + (message "debug-early-backtrace...done"))) (defalias 'debug--early #'(lambda (error base) - (princ "\nError: ") - (prin1 (car error)) ; The error symbol. - (princ " ") - (prin1 (cdr error)) ; The error data. - (debug-early-backtrace base))) + (if (eq error debugger--last-error) nil + (setq debugger--last-error nil) + (princ "\nError: ") + (prin1 (car error)) ; The error symbol. + (princ " ") + (prin1 (cdr error)) ; The error data. + (prog1 (debug-early-backtrace base) + (setq debugger--last-error error))))) (defalias 'debug-early ;Called from C. #'(lambda (&rest args) diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index f8af6eafa32..c1aaa1ac623 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -153,8 +153,6 @@ debugger--restore-buffer-state (insert (debugger--buffer-state-content state))) (goto-char (debugger--buffer-state-pos state))) -(defvar debugger--last-error nil) - (defun debugger--duplicate-p (args) (pcase args (`(error ,err . ,_) (and (consp err) (eq err debugger--last-error))))) From unknown Sat Aug 16 19:21:32 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 04 Apr 2025 11:24:17 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator