unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael <sp1ff@pobox.com>
To: Filipp Gunbin <fgunbin@fastmail.fm>
Cc: gazally@runbox.com, Lars Ingebrigtsen <larsi@gnus.org>,
	51037@debbugs.gnu.org
Subject: bug#51037: [PATCH] Make `print-level` & `print-length` customizable in ERT batch tests
Date: Mon, 22 Nov 2021 06:07:33 -0800	[thread overview]
Message-ID: <86h7c4l1wa.fsf@pobox.com> (raw)
In-Reply-To: <m2bl2ea2rz.fsf@fastmail.fm>


Filipp Gunbin <fgunbin@fastmail.fm> writes:

> On 20/11/2021 08:49 -0800, Michael wrote:
>
>>> On 19/11/2021 07:24 -0800, Michael wrote:
>>>
>>>> Lars Ingebrigtsen <larsi@gnus.org> writes:
>>>>
>>>>> Filipp Gunbin <fgunbin@fastmail.fm> 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 <sp1ff@pobox.com>





  reply	other threads:[~2021-11-22 14:07 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-05 14:28 bug#51037: [PATCH] Make `print-level` & `print-length` customizable in ERT batch tests Michael
2021-10-06  9:30 ` Lars Ingebrigtsen
2021-10-06 12:52   ` Eli Zaretskii
2021-10-07  7:59     ` Lars Ingebrigtsen
2021-10-07  8:25       ` Eli Zaretskii
2021-10-07 19:03         ` Lars Ingebrigtsen
2021-10-12 13:52           ` Michael
2021-10-13 11:07             ` Lars Ingebrigtsen
2021-10-13 13:41               ` Michael
2021-10-13 14:06                 ` Lars Ingebrigtsen
2021-10-24 19:50                   ` Michael
2021-10-25 13:03                     ` Gemini Lasswell
2021-10-26 21:02                       ` Michael
2021-10-27 13:13                         ` Lars Ingebrigtsen
2021-10-25 13:05                     ` Lars Ingebrigtsen
2021-10-26 21:10                       ` Michael
2021-10-27 13:15                         ` Lars Ingebrigtsen
2021-11-14  2:55                           ` Michael
2021-11-14  7:05                             ` Eli Zaretskii
2021-11-14 15:42                               ` Michael
2021-11-14 18:04                                 ` Eli Zaretskii
2021-11-15 23:11                                   ` Michael
2021-11-14 14:39                             ` Lars Ingebrigtsen
2021-11-14 14:42                               ` Lars Ingebrigtsen
2021-11-14 17:45                                 ` Michael
2021-11-14 17:50                                   ` Lars Ingebrigtsen
2021-11-15 23:32                                 ` Michael
2021-11-16  7:48                                   ` Lars Ingebrigtsen
2021-11-17 16:22                                     ` Filipp Gunbin
2021-11-18  9:27                                       ` Lars Ingebrigtsen
2021-11-18 13:51                                         ` Filipp Gunbin
2021-11-19 15:24                                         ` Michael
2021-11-19 18:46                                           ` Filipp Gunbin
2021-11-20 16:49                                             ` Michael
2021-11-20 22:19                                               ` Filipp Gunbin
2021-11-22 14:07                                                 ` Michael [this message]
2021-11-22 17:29                                                   ` Filipp Gunbin
2021-11-24 16:29                                                     ` Michael
2021-11-24 19:53                                                       ` Filipp Gunbin
2021-11-29 16:16                                                         ` Michael
2021-10-07 21:04       ` Andy Moreton
2021-10-07 22:04         ` Lars Ingebrigtsen
2021-10-08 13:49           ` Andy Moreton
2021-10-08 15:24   ` Michael
2021-10-09 11:19     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86h7c4l1wa.fsf@pobox.com \
    --to=sp1ff@pobox.com \
    --cc=51037@debbugs.gnu.org \
    --cc=fgunbin@fastmail.fm \
    --cc=gazally@runbox.com \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).