GNU bug report logs - #51037
[PATCH] Make `print-level` & `print-length` customizable in ERT batch tests

Previous Next

Package: emacs;

Reported by: Michael <sp1ff <at> runbox.com>

Date: Tue, 5 Oct 2021 14:51:02 UTC

Severity: wishlist

Tags: patch

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael <sp1ff <at> runbox.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: gazally <at> runbox.com, Eli Zaretskii <eliz <at> gnu.org>, 51037 <at> debbugs.gnu.org
Subject: bug#51037: [PATCH] Make `print-level` & `print-length` customizable in ERT batch tests
Date: Tue, 26 Oct 2021 14:10:01 -0700
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Michael <sp1ff <at> runbox.com> 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 <sp1ff <at> runbox.com>




This bug report was last modified 3 years and 171 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.