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: Mon, 22 Nov 2021 06:07:33 -0800 Message-ID: <86h7c4l1wa.fsf@pobox.com> References: <86tuhvmtpl.fsf@runbox.com> <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> <86bl3blcgm.fsf@runbox.com> <87wnlya9sj.fsf@gnus.org> <86wnlbmooj.fsf@runbox.com> <87fsry7qdy.fsf@gnus.org> <87bl2m7q9g.fsf@gnus.org> <86zgq5kn9y.fsf@runbox.com> <87ilws7d7e.fsf@gnus.org> <87pmqxlsob.fsf@gnus.org> <86pmqwkw1r.fsf@pobox.com> <86mtlylqm6.fsf@pobox.com> 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="26543"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.15; emacs 28.0.50 Cc: gazally@runbox.com, Lars Ingebrigtsen , 51037@debbugs.gnu.org To: Filipp Gunbin Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 22 15:09:13 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 1mpA0P-0006jy-15 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Nov 2021 15:09:13 +0100 Original-Received: from localhost ([::1]:51326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpA0N-0001Kg-Vq for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Nov 2021 09:09:12 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47840) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpA0F-0001ID-G8 for bug-gnu-emacs@gnu.org; Mon, 22 Nov 2021 09:09:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35762) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpA0E-0007Te-Dr for bug-gnu-emacs@gnu.org; Mon, 22 Nov 2021 09:09:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mpA0E-0007J1-4l for bug-gnu-emacs@gnu.org; Mon, 22 Nov 2021 09:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Nov 2021 14:09:02 +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.163759010728042 (code B ref 51037); Mon, 22 Nov 2021 14:09:02 +0000 Original-Received: (at 51037) by debbugs.gnu.org; 22 Nov 2021 14:08:27 +0000 Original-Received: from localhost ([127.0.0.1]:47308 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mp9zV-0007I3-UG for submit@debbugs.gnu.org; Mon, 22 Nov 2021 09:08:27 -0500 Original-Received: from transit01.runbox.com ([91.220.196.211]:48086) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mp9zU-0007Ho-CN for 51037@debbugs.gnu.org; Mon, 22 Nov 2021 09:08:16 -0500 Original-Received: from mailtransmit03.runbox ([10.9.9.163] helo=aibo.runbox.com) by transit01.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1mp9zN-008XUr-NX; Mon, 22 Nov 2021 15:08:09 +0100 Original-Received: from [10.9.9.72] (helo=submission01.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1mp9zA-00081L-95; Mon, 22 Nov 2021 15:07:56 +0100 Original-Received: by submission01.runbox with esmtpsa [Authenticated ID (942723)] (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) id 1mp9yx-0000qg-5u; Mon, 22 Nov 2021 15:07:43 +0100 In-reply-to: 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:220618 Archived-At: Filipp Gunbin writes: > On 20/11/2021 08:49 -0800, Michael wrote: > >>> On 19/11/2021 07:24 -0800, Michael wrote: >>> >>>> Lars Ingebrigtsen writes: >>>> >>>>> Filipp Gunbin writes: >>>>> >>>>>> The docstring for backtrace-line-length says: "If set to >>>>>> nil >>>>>> or >>>>>> zero, >>>>>> backtrace mode will not abbreviate the forms it prints." >>>>>> So >>>>>> the >>>>>> above >>>>>> sentence, which I removed, was indeed not true? (a quick >>>>>> look over >>>>>> its usages confirmed that to me, but I'd like someone else >>>>>> to >>>>>> check) >>>>> >>>>> I think the intention is that a nil value of >>>>> backtrace-line-length >>>>> shouldn't limit the lengths -- but I haven't tested it. >>>>> Doesn't it >>>>> work? >>>> >>>> Yes, I'm a bit lost, Filipp... what is your concern? And I >>>> thought I *had* tested that. >>> >>> That the docstring contained a sentence which is not true. A >>> minor >>> issue, of course. I give examples here: >>> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51037#117 >>> >>> (there was also fix of interactive spec of >>> `ert-run-tests-interactively', >>> but that's obvious I think) >>> >> Hey Filipp, >> >> Note that _is_ true, as far as I know, and was intended to be >> true before my patch, and I verified that it became true with >> my >> patch :) Can you provide a test case that demonstrates it to be >> not true? > > Yes, here > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=51037#117, as I > wrote above.. Oh.... oh, my-- you are on to something here, Filipp. My apologies for not seeing it sooner. The problem lies in: (defun cl-print-to-string-with-limit (print-function value limit) ... (setq limit (and (natnump limit) (not (zerop limit)) limit)) ;; Since this is used by the debugger when stack space may be ;; limited, if you increase print-level here, add more depth in ;; call_debugger (bug#31919). (let* ((print-length (when limit (min limit 50))) (print-level (when limit (min 8 (truncate (log limit))))) backtrace uses this function to print each frame, and as you can see, if called with `limit' set to nil, `print-le{vel,ength}` will *not* keep their current values, they will *also* be set to `nil`. So, we could do either of: 1. As Filipp suggests, just change the contract for `ert-batch-backtrace-line-length' to: if set to nil, you get full stack traces, period. 2. change `cl-print-to-string-with-limit' to respect the existing values of `print-length' & `print-level' when `limit' is nil. Note that the only caller (in Emacs) of this function is the backtrace package. I vote for option 2. What say you all? -- Michael