From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Newsgroups: gmane.emacs.bugs Subject: bug#51037: [PATCH] Make `print-level` & `print-length` customizable in ERT batch tests Date: Tue, 26 Oct 2021 14:10:01 -0700 Message-ID: <86bl3blcgm.fsf@runbox.com> References: <86tuhvmtpl.fsf@runbox.com> <877deqec10.fsf@gnus.org> <83fste2u4i.fsf@gnu.org> <87ily94662.fsf@gnus.org> <83fstd1bth.fsf@gnu.org> <87czogslm4.fsf@gnus.org> <86ily2mjtq.fsf@runbox.com> <87r1cp89o4.fsf@gnus.org> <86fst5m48v.fsf@runbox.com> <87a6jd5891.fsf@gnus.org> <86mtmykxro.fsf@runbox.com> <87y26hz24c.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17840"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.15; emacs 28.0.50 Cc: gazally@runbox.com, 51037@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 26 23:12:29 2021 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 1mfTkB-0004O8-Bp for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Oct 2021 23:12:27 +0200 Original-Received: from localhost ([::1]:49590 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfTk9-0001nH-V2 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Oct 2021 17:12:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfTio-0008Sh-8x for bug-gnu-emacs@gnu.org; Tue, 26 Oct 2021 17:11:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36143) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfTin-0005Za-Vx for bug-gnu-emacs@gnu.org; Tue, 26 Oct 2021 17:11:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mfTin-0006ZB-Qa for bug-gnu-emacs@gnu.org; Tue, 26 Oct 2021 17:11:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Oct 2021 21:11:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51037 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51037-submit@debbugs.gnu.org id=B51037.163528263425200 (code B ref 51037); Tue, 26 Oct 2021 21:11:01 +0000 Original-Received: (at 51037) by debbugs.gnu.org; 26 Oct 2021 21:10:34 +0000 Original-Received: from localhost ([127.0.0.1]:47689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mfTiM-0006YN-6P for submit@debbugs.gnu.org; Tue, 26 Oct 2021 17:10:34 -0400 Original-Received: from transit01.runbox.com ([91.220.196.211]:57056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mfTiJ-0006Y7-PM for 51037@debbugs.gnu.org; Tue, 26 Oct 2021 17:10:32 -0400 Original-Received: from aibo.runbox.com ([185.226.149.25]) by transit01.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1mfTiC-000x3F-Um; Tue, 26 Oct 2021 23:10:24 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector2; h=Content-Type:MIME-Version:Message-ID:Date:In-reply-to:Subject :Cc:To:From:References; bh=yxpohVUuxwsfrt90QAHWGmeH7IJcygMcz9sNLUqrXJo=; b=Mx hgIIhWUD9LYWuqdHeaoWm+RJhbY+sSwn7zFZ8Bv1JROKx3t9aMY01N7GHq6lDkpRYmQRcSd7WzhWz PSf3yCqOCF4N6lLrT7ouF2FCnz63vDDh10qesTAikyewyDIDUR1FApZnsCx9tiXky8ndRf4cNcwBD YA7qNbHhdPrz9UkdHwm6ndHhQ029RpEtndzx3HtJGB/OZOw/WBBdwexev8QMI3+YiPol7J1RkyYtS 7wANSAyVHEwWopNyuHaSBqvHJjmlG2b9Gn3EG3SWmaF+kbmgRG4+acgLAmhPQdYCzk829DI978UXH EbKCLHgxwlmmo/jo9BPHtJPSN5IipGMQ==; Original-Received: from [10.9.9.73] (helo=submission02.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1mfTiA-0002wP-DB; Tue, 26 Oct 2021 23:10:22 +0200 Original-Received: by submission02.runbox with esmtpsa [Authenticated ID (942723)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1mfTht-00005W-PI; Tue, 26 Oct 2021 23:10:06 +0200 In-reply-to: <87y26hz24c.fsf@gnus.org> 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" Xref: news.gmane.io gmane.emacs.bugs:218410 Archived-At: Lars Ingebrigtsen writes: > Michael writes: > >> The issue: stack traces are printed by the `backtrace` >> package. backtrace.el was authored by Gemini (which is why I've >> added him to this thread). backtrace.el doesn't directly work >> in >> terms of `print-le{ngth,vel}`: it defines a custom variable >> `backtrace-line-length` and then adjusts print-level & >> print-length in let bindings in order to: >> >> 1. try to respect the desired line length >> 2. not trigger bug 31919 (Lisp Debugger doesn't work when at >> stack limit) > > [...] > >> For myself, I was quite surprised to all learn this: I had to >> spend a fair bit of time digging through the source to find out >> what was happening to my settings for print-length & >> print-level. > > Yeah, I didn't remember `backtrace-line-length' either. Perhaps > it > should be linked to from the doc strings of print-length and > print-level... I was thinking to augment the docstring for `backtrace-line-lenght' to note that print-level & print-length will be overiden to honor it. >> My personal incliniation is to remove the >> `backtrace-line-length` >> variable entirely, and make the `debug` package responsible for >> controlling print-level so as to avoid 31919. But that's me: is >> there a compelling use-case for backtrace.el working in terms >> of >> limiting line length rather than just using >> `print-le{ve,ength}`? > > Well... if we're talking in an ert context, it could increase > both the > backtrace-line-length and max-lisp-eval-depth variables when > gathering > the backtrace, I think? The problem is that I can't know a priori how big I have to set them in order to honor print-level & print-length. I think I can short-circuit this entirely by setting `backtrace-line-length' to nil or zero before printing the backtrace from ert. eval-level shouldn't enter into it I think; the concern was that if code exceeded max-lisp-eval-depth, and the debugger was triggered, *then* backtrace.el might have problems. Do you see a reason to be concerned outside of that corner case? -- Michael