From unknown Sun Jun 15 07:57:00 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#38927 <38927@debbugs.gnu.org> To: bug#38927 <38927@debbugs.gnu.org> Subject: Status: [patch] Backtrace printing in non-interactive mode doesn't use cl-prin1 etc. Reply-To: bug#38927 <38927@debbugs.gnu.org> Date: Sun, 15 Jun 2025 14:57:00 +0000 retitle 38927 [patch] Backtrace printing in non-interactive mode doesn't us= e cl-prin1 etc. reassign 38927 emacs submitter 38927 Paul Pogonyshev severity 38927 normal tag 38927 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 04 17:02:12 2020 Received: (at submit) by debbugs.gnu.org; 4 Jan 2020 22:02:12 +0000 Received: from localhost ([127.0.0.1]:43466 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inrUq-0002Sy-Cs for submit@debbugs.gnu.org; Sat, 04 Jan 2020 17:02:12 -0500 Received: from lists.gnu.org ([209.51.188.17]:36553) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inrUp-0002Sq-2a for submit@debbugs.gnu.org; Sat, 04 Jan 2020 17:02:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49575) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inrUn-00081a-Ma for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2020 17:02:10 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inrUm-0001lK-7R for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2020 17:02:09 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:44768) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inrUl-0001d9-VI for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2020 17:02:08 -0500 Received: by mail-wr1-x436.google.com with SMTP id q10so6696013wrm.11 for ; Sat, 04 Jan 2020 14:02:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=8LnoS8KlmCrWAWhjEf9G3FpZhgPCKT74phzfxxjZPmw=; b=StGsujSdCb/2BkRnThNP11/6qWq8LoU39IJqERxef90+9+PsAjozKjmAfRKV4OkfjX 23AItpBL8pKNNcQjshHFf0xDMELaUh6jFWpmnvqMtYeeQoogsJwojmUfLz9ZMTQfuP4A SQJvvB9cNCqBq2S0BQxmMoQKm5h+uXn7w8P1zgIcRFz381ySl83fSgBUShmKJzWbtVBd OXbJVED9k9wgnr6c8O6qe0YSIQtIjD6jcCCTEgJ18p7bC8aOB4bM+a8Xmdnjoarxv2Ag 5xp4kc852b2dZhJM0OSGq/5Q7122TItcQH6zAQsh0DcuU3+PRjxtcQiFjQYS9Ulcu+8h +wAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=8LnoS8KlmCrWAWhjEf9G3FpZhgPCKT74phzfxxjZPmw=; b=f/ZD+fwbhz2gphyjzYdh4T5OxOKxz1c+TSyQEOqQ+DXjlfqfvZZX1+6NZG7pZ1lA7Z A9Pw0fZkAsq5ze7IGt/MKihqQG9xymdU/WtjlhNJvZTXxVQCz9hHqeh0YIY0vHu7xczv tCkp+DrtctSV6rLsoTvZnruJfy0w0oCPHR3BUIj2CHdEUQwdOzpnUCat3Do9i8x8B35L 68PT95KdfWkXL/e4cjPxIeWMygHu2BnEQa2sl7ARV+EIqFVSllxVDa0NM54ehB736nkB mU5/YFzMWBNfQJAhhUU6iYMMY8TN+zGZhXDrMUBNCYEpmcaElaz+uw42f5mn/1SZ5bml D0Nw== X-Gm-Message-State: APjAAAVgQq/gH4ghXaaydVJ3FhKkzw3oDm5SUv+uPwfr3m5TPzLIBKWU zJBm4PCNis7uQgwb/zYWAewdtBzlh72TKIelwXbcGnM= X-Google-Smtp-Source: APXvYqxa1GVT1XMqdgsYHsFw88zzwc+FwNrfdwUu/YLJvXfjqG4wBE944hI/NIlxZL0JHD9csBagEEQcSB5jdsSQ3ck= X-Received: by 2002:adf:e3c1:: with SMTP id k1mr91774920wrm.151.1578175325417; Sat, 04 Jan 2020 14:02:05 -0800 (PST) MIME-Version: 1.0 From: Paul Pogonyshev Date: Sat, 4 Jan 2020 23:01:53 +0100 Message-ID: Subject: [patch] Backtrace printing in non-interactive mode doesn't use cl-prin1 etc. To: bug-gnu-emacs@gnu.org Content-Type: multipart/mixed; boundary="000000000000aa5da0059b5793c2" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::436 X-Spam-Score: 0.7 (/) 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: -2.3 (--) --000000000000aa5da0059b5793c2 Content-Type: text/plain; charset="UTF-8" tags Backtrace printing in batch mode ignores all customizations, at least: - all `cl-print-object' overrides (`debugger-print-function'); - `print-level', `print-length' and friends; - `debugger-batch-max-lines'. The reason is this commit: 7228488effa78dcb75284cb6d247b24804e0e7f5 Author: Stefan Monnier AuthorDate: 2018-04-02 00:23:20 -0400 [...] * lisp/emacs-lisp/debug.el (debug): Don't hang upon error in initial-frame. [...] + ((and (eq t (framep (selected-frame))) + (equal "initial_terminal" (terminal-name))) + ;; We're in the initial-frame (where `message' just outputs to stdout) so + ;; there's no tty or GUI frame to display the backtrace and interact with + ;; it: just dump a backtrace to stdout. + ;; This happens for example while handling an error in code from + ;; early-init.el with --debug-init. + (message "Error: %S" args) [...] The commit added a "failsafe" mode for (quoting) "initial-frame (where `message' just outputs to stdout) so there's no tty or GUI frame". This failsafe mode is also erroneously triggered in batch mode. It was never meant for it: you can see a couple of uses of `noninteractive' in the next `cond' branch, but execution now never gets to it. Patch attached: - don't use this "failsafe" mode when running non-interactively; - repair for the latest changes in backtrace generation (apparently, before the buffer was not read-only); - repair adjustment for `debugger-batch-max-lines' which didn't make any sense and didn't achieve what it claimed in the comment. Paul --000000000000aa5da0059b5793c2 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Don-t-apply-the-special-case-to-non-interactive-mode.patch" Content-Disposition: attachment; filename="0001-Don-t-apply-the-special-case-to-non-interactive-mode.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_k504tysf0 RnJvbSAxODBmNGE0Zjc3MTY5NjUxMmFmMzFkZWQ5MzA1NzcxM2E1NTA3MTQ3IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIFBvZ29ueXNoZXYgPHBvZ29ueXNoZXZAZ21haWwuY29t PgpEYXRlOiBTYXQsIDQgSmFuIDIwMjAgMjI6NDc6MjQgKzAxMDAKU3ViamVjdDogW1BBVENIXSBE b24ndCBhcHBseSB0aGUgc3BlY2lhbCBjYXNlIHRvIG5vbi1pbnRlcmFjdGl2ZSBtb2RlIGluCiBg ZGVidWcnCgotLS0KIGxpc3AvZW1hY3MtbGlzcC9kZWJ1Zy5lbCB8IDI1ICsrKysrKysrKysrKyst LS0tLS0tLS0tLS0KIDEgZmlsZSBjaGFuZ2VkLCAxMyBpbnNlcnRpb25zKCspLCAxMiBkZWxldGlv bnMoLSkKCmRpZmYgLS1naXQgYS9saXNwL2VtYWNzLWxpc3AvZGVidWcuZWwgYi9saXNwL2VtYWNz LWxpc3AvZGVidWcuZWwKaW5kZXggM2RmMGJhNGE2NS4uYjZjNThiOGM3YiAxMDA2NDQKLS0tIGEv bGlzcC9lbWFjcy1saXNwL2RlYnVnLmVsCisrKyBiL2xpc3AvZW1hY3MtbGlzcC9kZWJ1Zy5lbApA QCAtMTcyLDcgKzE3Miw4IEBAIGRlYnVnCiAgICAoaW5oaWJpdC1yZWRpc3BsYXkKICAgICA7OyBE b24ndCByZWFsbHkgdHJ5IHRvIGVudGVyIGRlYnVnZ2VyIHdpdGhpbiBhbiBldmFsIGZyb20gcmVk aXNwbGF5LgogICAgIGRlYnVnZ2VyLXZhbHVlKQotICAgKChhbmQgKGVxIHQgKGZyYW1lcCAoc2Vs ZWN0ZWQtZnJhbWUpKSkKKyAgICgoYW5kIChub3Qgbm9uaW50ZXJhY3RpdmUpCisgICAgICAgICAo ZXEgdCAoZnJhbWVwIChzZWxlY3RlZC1mcmFtZSkpKQogICAgICAgICAgKGVxdWFsICJpbml0aWFs X3Rlcm1pbmFsIiAodGVybWluYWwtbmFtZSkpKQogICAgIDs7IFdlJ3JlIGluIHRoZSBpbml0aWFs LWZyYW1lICh3aGVyZSBgbWVzc2FnZScganVzdCBvdXRwdXRzIHRvIHN0ZG91dCkgc28KICAgICA7 OyB0aGVyZSdzIG5vIHR0eSBvciBHVUkgZnJhbWUgdG8gZGlzcGxheSB0aGUgYmFja3RyYWNlIGFu ZCBpbnRlcmFjdCB3aXRoCkBAIC0yNDYsMTcgKzI0NywxNyBAQCBkZWJ1ZwogCSAgICAgICAgKHdo ZW4gbm9uaW50ZXJhY3RpdmUKIAkJICA7OyBJZiB0aGUgYmFja3RyYWNlIGlzIGxvbmcsIHNhdmUg dGhlIGJlZ2lubmluZwogCQkgIDs7IGFuZCB0aGUgZW5kLCBidXQgZGlzY2FyZCB0aGUgbWlkZGxl LgotCQkgICh3aGVuICg+IChjb3VudC1saW5lcyAocG9pbnQtbWluKSAocG9pbnQtbWF4KSkKLQkJ CSAgIGRlYnVnZ2VyLWJhdGNoLW1heC1saW5lcykKLQkJICAgIChnb3RvLWNoYXIgKHBvaW50LW1p bikpCi0JCSAgICAoZm9yd2FyZC1saW5lICgvIDIgZGVidWdnZXItYmF0Y2gtbWF4LWxpbmVzKSkK LQkJICAgIChsZXQgKChtaWRkbGVzdGFydCAocG9pbnQpKSkKLQkJICAgICAgKGdvdG8tY2hhciAo cG9pbnQtbWF4KSkKLQkJICAgICAgKGZvcndhcmQtbGluZSAoLSAoLyAyIGRlYnVnZ2VyLWJhdGNo LW1heC1saW5lcykKLQkJCQkgICAgICAgZGVidWdnZXItYmF0Y2gtbWF4LWxpbmVzKSkKLQkJICAg ICAgKGRlbGV0ZS1yZWdpb24gbWlkZGxlc3RhcnQgKHBvaW50KSkpCi0JCSAgICAoaW5zZXJ0ICIu Li5cbiIpKQotCQkgIChnb3RvLWNoYXIgKHBvaW50LW1pbikpCisgICAgICAgICAgICAgICAgICAo bGV0ICgoaW5oaWJpdC1yZWFkLW9ubHkgdCkpCisJCSAgICAod2hlbiAoPiAoY291bnQtbGluZXMg KHBvaW50LW1pbikgKHBvaW50LW1heCkpCisJCQkgICAgIGRlYnVnZ2VyLWJhdGNoLW1heC1saW5l cykKKwkJICAgICAgKGdvdG8tY2hhciAocG9pbnQtbWluKSkKKwkJICAgICAgKGZvcndhcmQtbGlu ZSAoLyBkZWJ1Z2dlci1iYXRjaC1tYXgtbGluZXMgNCkpCisJCSAgICAgIChsZXQgKChtaWRkbGVz dGFydCAocG9pbnQpKSkKKwkJICAgICAgICAoZ290by1jaGFyIChwb2ludC1tYXgpKQorCQkgICAg ICAgIChmb3J3YXJkLWxpbmUgKC0gKC8gMiBkZWJ1Z2dlci1iYXRjaC1tYXgtbGluZXMpCisJCQkJ ICAgICAgICAgZGVidWdnZXItYmF0Y2gtbWF4LWxpbmVzKSkKKwkJICAgICAgICAoZGVsZXRlLXJl Z2lvbiBtaWRkbGVzdGFydCAocG9pbnQpKSkKKwkJICAgICAgKGluc2VydCAiLi4uXG4iKSkpCiAJ CSAgKG1lc3NhZ2UgIiVzIiAoYnVmZmVyLXN0cmluZykpCiAJCSAgKGtpbGwtZW1hY3MgLTEpKSkK IAkgICAgICAocG9wLXRvLWJ1ZmZlcgotLSAKMi4yMC4xCgo= --000000000000aa5da0059b5793c2-- From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 29 00:06:32 2020 Received: (at 38927) by debbugs.gnu.org; 29 Feb 2020 05:06:32 +0000 Received: from localhost ([127.0.0.1]:34127 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j7uKe-0004pj-3l for submit@debbugs.gnu.org; Sat, 29 Feb 2020 00:06:32 -0500 Received: from ted.gofardesign.uk ([67.225.143.91]:37142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j7uKc-0004pU-7T for 38927@debbugs.gnu.org; Sat, 29 Feb 2020 00:06:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=marxist.se; s=default; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hbSpvc0klLC2x4Xt2jazlAcGZkoZQZDNOyYxbhcxDgI=; b=Uip2dDbS5zT7+5zjDrwmMPR0p9 M9ckmORPmg6zdQcUFHHfJc2WJwkpHUxS1zo9z8SZ2BrR/G4zwxmiNz1wTRDvzVJAFA7hSP89ed2Mo gw5VEfWXAFybkyPX8SNg0OpNu/ebmtAQFYKxiIQcHPqFX5NZQdneSCOO/ck3IYPw8Z6OOiQiu/vrT 6rXOo6Ywd85kSu5P9wt/YeuG/9SvREQDWuZ3Q4/pN3wGVV39i4Xr6pAqsrjcj8aexZoKibB81wAaQ o5wZuJSm1xo1sND72jMSdtavoCjN+ODZgGMZTydPWSPkYgvo0+xp5ARyAOMFWTv5vElkgpOsOLAAN 72IDVyfA==; Received: from h-4-70-69.a785.priv.bahnhof.se ([155.4.70.69]:39948 helo=localhost) by ted.gofardesign.uk with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1j7uKW-001nWR-FQ; Sat, 29 Feb 2020 00:06:24 -0500 From: Stefan Kangas To: Stefan Monnier Subject: Re: bug#38927: [patch] Backtrace printing in non-interactive mode doesn't use cl-prin1 etc. In-Reply-To: (Paul Pogonyshev's message of "Sat, 4 Jan 2020 23:01:53 +0100") References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Date: Sat, 29 Feb 2020 06:06:23 +0100 Message-ID: <87fteu6kz4.fsf@stefankangas.se> MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - ted.gofardesign.uk X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - marxist.se X-Get-Message-Sender-Via: ted.gofardesign.uk: authenticated_id: stefan@marxist.se X-Authenticated-Sender: ted.gofardesign.uk: stefan@marxist.se X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 38927 Cc: 38927@debbugs.gnu.org, Paul Pogonyshev 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 (-) Hi Stefan, Do you have any comments on the below patch? It seems to relate to a commit of yours, but has unfortunately not received any reply yet. Thanks in advance. Best regards, Stefan Kangas Paul Pogonyshev writes: > tags > > Backtrace printing in batch mode ignores all customizations, at least: > - all `cl-print-object' overrides (`debugger-print-function'); > - `print-level', `print-length' and friends; > - `debugger-batch-max-lines'. > > The reason is this commit: > > 7228488effa78dcb75284cb6d247b24804e0e7f5 > Author: Stefan Monnier > AuthorDate: 2018-04-02 00:23:20 -0400 > [...] > > * lisp/emacs-lisp/debug.el (debug): Don't hang upon error in initial-frame. > > [...] > + ((and (eq t (framep (selected-frame))) > + (equal "initial_terminal" (terminal-name))) > + ;; We're in the initial-frame (where `message' just outputs to stdout) so > + ;; there's no tty or GUI frame to display the backtrace and interact with > + ;; it: just dump a backtrace to stdout. > + ;; This happens for example while handling an error in code from > + ;; early-init.el with --debug-init. > + (message "Error: %S" args) > [...] > > The commit added a "failsafe" mode for (quoting) "initial-frame (where > `message' just outputs to stdout) so there's no tty or GUI frame". > This failsafe mode is also erroneously triggered in batch mode. It was > never meant for it: you can see a couple of uses of `noninteractive' > in the next `cond' branch, but execution now never gets to it. > > Patch attached: > - don't use this "failsafe" mode when running non-interactively; > - repair for the latest changes in backtrace generation (apparently, > before the buffer was not read-only); > - repair adjustment for `debugger-batch-max-lines' which didn't make > any sense and didn't achieve what it claimed in the comment. > > Paul > > From 180f4a4f771696512af31ded93057713a5507147 Mon Sep 17 00:00:00 2001 > From: Paul Pogonyshev > Date: Sat, 4 Jan 2020 22:47:24 +0100 > Subject: [PATCH] Don't apply the special case to non-interactive mode in > `debug' > > --- > lisp/emacs-lisp/debug.el | 25 +++++++++++++------------ > 1 file changed, 13 insertions(+), 12 deletions(-) > > diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el > index 3df0ba4a65..b6c58b8c7b 100644 > --- a/lisp/emacs-lisp/debug.el > +++ b/lisp/emacs-lisp/debug.el > @@ -172,7 +172,8 @@ debug > (inhibit-redisplay > ;; Don't really try to enter debugger within an eval from redisplay. > debugger-value) > - ((and (eq t (framep (selected-frame))) > + ((and (not noninteractive) > + (eq t (framep (selected-frame))) > (equal "initial_terminal" (terminal-name))) > ;; We're in the initial-frame (where `message' just outputs to stdout) so > ;; there's no tty or GUI frame to display the backtrace and interact with > @@ -246,17 +247,17 @@ debug > (when noninteractive > ;; If the backtrace is long, save the beginning > ;; and the end, but discard the middle. > - (when (> (count-lines (point-min) (point-max)) > - debugger-batch-max-lines) > - (goto-char (point-min)) > - (forward-line (/ 2 debugger-batch-max-lines)) > - (let ((middlestart (point))) > - (goto-char (point-max)) > - (forward-line (- (/ 2 debugger-batch-max-lines) > - debugger-batch-max-lines)) > - (delete-region middlestart (point))) > - (insert "...\n")) > - (goto-char (point-min)) > + (let ((inhibit-read-only t)) > + (when (> (count-lines (point-min) (point-max)) > + debugger-batch-max-lines) > + (goto-char (point-min)) > + (forward-line (/ debugger-batch-max-lines 4)) > + (let ((middlestart (point))) > + (goto-char (point-max)) > + (forward-line (- (/ 2 debugger-batch-max-lines) > + debugger-batch-max-lines)) > + (delete-region middlestart (point))) > + (insert "...\n"))) > (message "%s" (buffer-string)) > (kill-emacs -1))) > (pop-to-buffer From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 29 09:07:20 2020 Received: (at 38927-done) by debbugs.gnu.org; 29 Feb 2020 14:07:21 +0000 Received: from localhost ([127.0.0.1]:34347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j82m0-0003LR-K1 for submit@debbugs.gnu.org; Sat, 29 Feb 2020 09:07:20 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:31338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j82lz-0003LD-1T for 38927-done@debbugs.gnu.org; Sat, 29 Feb 2020 09:07:19 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 383B31004B3; Sat, 29 Feb 2020 09:07:13 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 44E3D100271; Sat, 29 Feb 2020 09:07:11 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1582985231; bh=nR2TIYpNDYA0YbgFwYBaMIXrE2Qc/4NvKXOZhF9YNOA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=dTMC0OHuR5FO0wGsI30ut6s0aW551zxKCh9HUAzsg/0n6psASJrn/+pWKD+Sju8Xz YQYRiiqPcnLsIlSBmPDqXNltwKJ5wpj8h+a//leItCfDaZnbAc2wkzJJXQ+QDv9ETx hB8CEi1+6TbHGxBRUeVVNIKCkMkOkSNyXz0Kbq599R/VSggV5uq6m6ZTWUY1iRaYWD pToyaOHyeAXJuYXhyI8Jq+oRSA5F2n0JH37mH2z0+n2JcXVJheWuoSkiI8uQe0RrrU Ibs+ktnvo4iBjQpAPgKNXnjAOWwu6a8avculSX3h7s6i89mM0mbvexFfLrOPjB3AYF BvDEu8ad/TUyQ== Received: from pastel (unknown [216.154.50.221]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id A3E6212061D; Sat, 29 Feb 2020 09:07:10 -0500 (EST) From: Stefan Monnier To: Stefan Kangas Subject: Re: bug#38927: [patch] Backtrace printing in non-interactive mode doesn't use cl-prin1 etc. Message-ID: References: <87fteu6kz4.fsf@stefankangas.se> Date: Sat, 29 Feb 2020 09:07:08 -0500 In-Reply-To: <87fteu6kz4.fsf@stefankangas.se> (Stefan Kangas's message of "Sat, 29 Feb 2020 06:06:23 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) 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.070 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 X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 38927-done Cc: 38927-done@debbugs.gnu.org, Paul Pogonyshev 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 (---) > Do you have any comments on the below patch? It seems to relate to a > commit of yours, but has unfortunately not received any reply yet. Hmm... looks like the bug tracker was kept out of the discussion. This has been fixed already by 0223a1577c8999b8ea5eb35f39bc68360cbf5221 Stefan > Paul Pogonyshev writes: > >> tags >> >> Backtrace printing in batch mode ignores all customizations, at least: >> - all `cl-print-object' overrides (`debugger-print-function'); >> - `print-level', `print-length' and friends; >> - `debugger-batch-max-lines'. >> >> The reason is this commit: >> >> 7228488effa78dcb75284cb6d247b24804e0e7f5 >> Author: Stefan Monnier >> AuthorDate: 2018-04-02 00:23:20 -0400 >> [...] >> >> * lisp/emacs-lisp/debug.el (debug): Don't hang upon error in initial-frame. >> >> [...] >> + ((and (eq t (framep (selected-frame))) >> + (equal "initial_terminal" (terminal-name))) >> + ;; We're in the initial-frame (where `message' just outputs to stdout) so >> + ;; there's no tty or GUI frame to display the backtrace and interact with >> + ;; it: just dump a backtrace to stdout. >> + ;; This happens for example while handling an error in code from >> + ;; early-init.el with --debug-init. >> + (message "Error: %S" args) >> [...] >> >> The commit added a "failsafe" mode for (quoting) "initial-frame (where >> `message' just outputs to stdout) so there's no tty or GUI frame". >> This failsafe mode is also erroneously triggered in batch mode. It was >> never meant for it: you can see a couple of uses of `noninteractive' >> in the next `cond' branch, but execution now never gets to it. >> >> Patch attached: >> - don't use this "failsafe" mode when running non-interactively; >> - repair for the latest changes in backtrace generation (apparently, >> before the buffer was not read-only); >> - repair adjustment for `debugger-batch-max-lines' which didn't make >> any sense and didn't achieve what it claimed in the comment. >> >> Paul >> >> From 180f4a4f771696512af31ded93057713a5507147 Mon Sep 17 00:00:00 2001 >> From: Paul Pogonyshev >> Date: Sat, 4 Jan 2020 22:47:24 +0100 >> Subject: [PATCH] Don't apply the special case to non-interactive mode in >> `debug' >> >> --- >> lisp/emacs-lisp/debug.el | 25 +++++++++++++------------ >> 1 file changed, 13 insertions(+), 12 deletions(-) >> >> diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el >> index 3df0ba4a65..b6c58b8c7b 100644 >> --- a/lisp/emacs-lisp/debug.el >> +++ b/lisp/emacs-lisp/debug.el >> @@ -172,7 +172,8 @@ debug >> (inhibit-redisplay >> ;; Don't really try to enter debugger within an eval from redisplay. >> debugger-value) >> - ((and (eq t (framep (selected-frame))) >> + ((and (not noninteractive) >> + (eq t (framep (selected-frame))) >> (equal "initial_terminal" (terminal-name))) >> ;; We're in the initial-frame (where `message' just outputs to stdout) so >> ;; there's no tty or GUI frame to display the backtrace and interact with >> @@ -246,17 +247,17 @@ debug >> (when noninteractive >> ;; If the backtrace is long, save the beginning >> ;; and the end, but discard the middle. >> - (when (> (count-lines (point-min) (point-max)) >> - debugger-batch-max-lines) >> - (goto-char (point-min)) >> - (forward-line (/ 2 debugger-batch-max-lines)) >> - (let ((middlestart (point))) >> - (goto-char (point-max)) >> - (forward-line (- (/ 2 debugger-batch-max-lines) >> - debugger-batch-max-lines)) >> - (delete-region middlestart (point))) >> - (insert "...\n")) >> - (goto-char (point-min)) >> + (let ((inhibit-read-only t)) >> + (when (> (count-lines (point-min) (point-max)) >> + debugger-batch-max-lines) >> + (goto-char (point-min)) >> + (forward-line (/ debugger-batch-max-lines 4)) >> + (let ((middlestart (point))) >> + (goto-char (point-max)) >> + (forward-line (- (/ 2 debugger-batch-max-lines) >> + debugger-batch-max-lines)) >> + (delete-region middlestart (point))) >> + (insert "...\n"))) >> (message "%s" (buffer-string)) >> (kill-emacs -1))) >> (pop-to-buffer From unknown Sun Jun 15 07:57:00 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 29 Mar 2020 11:24:04 +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