unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Jeremy Phelps <jeremyphelps077@gmail.com>
To: 59540@debbugs.gnu.org
Subject: bug#59540: Calling length on a very long improper list is disastrous.
Date: Thu, 24 Nov 2022 05:52:51 -0500	[thread overview]
Message-ID: <CA+-17hVg390gZHxD7LmAO62oTFmH6mT8zq6MOyGCYSsi1aKWdw@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

I lost my Emacs session today because I accidentally called the length
function on an extremely long improper list.

But Guile prints the entire thing when it reports the error that happens
when the length function gets to the improper part of the list. It tried to
print a few million elements just to tell me which list wasn't a proper
list.

To reproduce the error should be easy:

(length

   (let loop ((result 'x)

              (n 50000000))

     (if (= n 0)

         result

         (loop (cons n result) (- n 1)))))


Emacs is more sensitive to the problem because it doesn't throw away any of
the output. It's also really bad over SSH. The above test is enough to dump
output to a local terminal for a minute or two, or to uninterruptibly tie
up an SSH session for several minutes.

[-- Attachment #2: Type: text/html, Size: 1687 bytes --]

             reply	other threads:[~2022-11-24 10:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 10:52 Jeremy Phelps [this message]
2022-12-10 17:27 ` bug#59540: Calling length on a very long improper list is disastrous Ludovic Courtès
2022-12-12  9:25   ` lloda
2022-12-12 11:45     ` Ludovic Courtès

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/guile/

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

  git send-email \
    --in-reply-to=CA+-17hVg390gZHxD7LmAO62oTFmH6mT8zq6MOyGCYSsi1aKWdw@mail.gmail.com \
    --to=jeremyphelps077@gmail.com \
    --cc=59540@debbugs.gnu.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.
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).