GNU bug report logs - #18012
24.3; Can't print a huge list structure in IELM

Previous Next

Package: emacs;

Reported by: sindikat <at> mail36.net (sindikat <at> mail36.net)

Date: Mon, 14 Jul 2014 07:13:02 UTC

Severity: minor

Found in version 24.3

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

Bug is archived. No further changes may be made.

Full log


Message #13 received at 18012 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: npostavs <at> users.sourceforge.net
Cc: "sindikat <at> mail36.net" <sindikat <at> mail36.net>, 18012 <at> debbugs.gnu.org
Subject: Re: bug#18012: 24.3; Can't print a huge list structure in IELM
Date: Thu, 12 Apr 2018 14:32:16 +0100
npostavs <at> users.sourceforge.net writes:

> sindikat <at> mail36.net (sindikat <at> mail36.net) writes:
>
>> I have a function that creates a nested list in the form (x (x (x (x
>> (...))))) arbitrarily deep:
>>
>> (defun nestify (xs)
>>   (cl-reduce (lambda (x y) (if y (list x y) (list x))) xs :from-end t
>>   :initial-value nil))
>>
>> In IELM when I try to call it on a sufficiently big list, it crashes
>> with an error:
>>
>> ELISP> (nestify (number-sequence 1 1000))
>> *** IELM Error ***  Error during pretty-printing (bug in pp)
>
> It seems that the circularity check when print-circle is nil stops at a
> depth of 200.
>
> (prin1 (nestify (number-sequence 1 200))) ;=> (error "Apparently circular
> structure being printed")
>
> Setting print-circle to t makes this (and printing for ielm) work fine.
> Maybe ielm should bind print-circle to t always?

I agree, given that ielm now uses cl-prin1:

81b5131e11: 2018-01-15 17:04:05 -0500
  * lisp/ielm.el (ielm-eval-input): Use cl-print.
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=81b5131e11fa96d32a1718c6e2ebf40994d7d281

and thus infloops in the following scenario:

1. emacs -Q
2. M-x emacs-version RET
     => GNU Emacs 27.0.50
        (build 2, x86_64-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
        of 2018-04-08
3. M-x ielm RET
4. (let ((l (make-list 2 0)))
     (nconc l (cdr l)))
5. C-m
     => infloop
6. C-g
     => *** IELM Error ***  Quit during pretty-printing

This is in contrast to the *scratch* buffer, where C-j correctly inserts
the result of (4) as (0 0 . #1), presumably because pp is used instead
of cl-prin1.

Does this behaviour warrant a new bug?

-- 
Basil




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

Previous Next


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