From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Newsgroups: gmane.lisp.guile.bugs Subject: bug#59540: Calling length on a very long improper list is disastrous. Date: Sat, 10 Dec 2022 18:27:50 +0100 Message-ID: <87r0x7419l.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7353"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Cc: 59540@debbugs.gnu.org To: Jeremy Phelps Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sat Dec 10 18:28:24 2022 Return-path: Envelope-to: guile-bugs@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 1p43eC-0001hS-1j for guile-bugs@m.gmane-mx.org; Sat, 10 Dec 2022 18:28:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p43ds-00067k-Cj; Sat, 10 Dec 2022 12:28:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p43dq-000678-95 for bug-guile@gnu.org; Sat, 10 Dec 2022 12:28:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p43dq-0008RW-0u for bug-guile@gnu.org; Sat, 10 Dec 2022 12:28:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p43dp-0001Gy-Sm for bug-guile@gnu.org; Sat, 10 Dec 2022 12:28:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 10 Dec 2022 17:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59540 X-GNU-PR-Package: guile Original-Received: via spool by 59540-submit@debbugs.gnu.org id=B59540.16706932804886 (code B ref 59540); Sat, 10 Dec 2022 17:28:01 +0000 Original-Received: (at 59540) by debbugs.gnu.org; 10 Dec 2022 17:28:00 +0000 Original-Received: from localhost ([127.0.0.1]:44070 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p43dn-0001Gk-Sg for submit@debbugs.gnu.org; Sat, 10 Dec 2022 12:28:00 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51494) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p43dm-0001Ga-KW for 59540@debbugs.gnu.org; Sat, 10 Dec 2022 12:27:59 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p43dh-00088b-8k; Sat, 10 Dec 2022 12:27:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=aFOKGrZGMdFje+Za2nCsQB40GZbB/pgwgrLPrZnCizs=; b=IgNXe8H5MsVcc8LvsA5+ 7hJ/JBV5ziRmoxun4U150j7aiBp51tjdrlkkzURDJVvZaDlVEoAxIseVORVJ25TSHzzVYGZXu7gb3 TuThtuDmSw43M+fBF18C7N5hDOMJ00iCyBRmik4YVpEcfJE2hRtgN4D2I5ZPJUX9iwLfpoKenCe2G 0JfSY8PBA5bc8Wa156gmZ6hSRfqfUjXhbOv1+gb+rJ7rCKS0qZrPBWPjrfWa/iZXr9PXSqkpjM0uh ZnwpqtIb2CzLJHaTLEah8y5HTZnszQA0TQ+A1Uta1qMD/+eMlaqYpAUx2iPzru/NEslVDDnS6RLpP MsysK76JMioL7Q==; Original-Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p43dg-0008HT-Nv; Sat, 10 Dec 2022 12:27:52 -0500 In-Reply-To: (Jeremy Phelps's message of "Thu, 24 Nov 2022 05:52:51 -0500") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.bugs:10462 Archived-At: Hi Jeremy, Jeremy Phelps skribis: > 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 (=3D 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 du= mp > output to a local terminal for a minute or two, or to uninterruptibly tie > up an SSH session for several minutes. I think there are several issues here: 1. =E2=80=98length=E2=80=99 takes time linear to the size of the list (for non-circular lists). That=E2=80=99s how it=E2=80=99s specified in the= Scheme reports. 2. Guile doesn=E2=80=99t truncate arguments that come after the =E2=80=9C= Wrong type argument=E2=80=9D error message. 3. Emacs poorly handles very long lines, to put it mildly. Of these only #2 is something we could work on. However, truncation has proven to be a hindrance sometimes (in backtraces, objects are automatically), so I=E2=80=99m not sure we want to enable it by default on wrong-type-arg error messages. Thoughts? Ludo=E2=80=99.