From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jeremy Phelps Newsgroups: gmane.lisp.guile.bugs Subject: bug#59540: Calling length on a very long improper list is disastrous. Date: Thu, 24 Nov 2022 05:52:51 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000088939d05ee3535be" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15624"; mail-complaints-to="usenet@ciao.gmane.io" To: 59540@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Thu Nov 24 12:06:52 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 1oyA4B-0003qV-6k for guile-bugs@m.gmane-mx.org; Thu, 24 Nov 2022 12:06:51 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oyA3Q-00088x-Dm; Thu, 24 Nov 2022 06:06: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 1oyA3P-00088F-0t for bug-guile@gnu.org; Thu, 24 Nov 2022 06:06:03 -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 1oyA3O-0006rW-Pa for bug-guile@gnu.org; Thu, 24 Nov 2022 06:06:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oyA3O-0007Jx-HL for bug-guile@gnu.org; Thu, 24 Nov 2022 06:06:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jeremy Phelps Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 24 Nov 2022 11:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59540 X-GNU-PR-Package: guile X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.166928795728129 (code B ref -1); Thu, 24 Nov 2022 11:06:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Nov 2022 11:05:57 +0000 Original-Received: from localhost ([127.0.0.1]:57491 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oyA3I-0007Jc-R1 for submit@debbugs.gnu.org; Thu, 24 Nov 2022 06:05:57 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:50820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oy9qr-0006z8-5W for submit@debbugs.gnu.org; Thu, 24 Nov 2022 05:53:05 -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 1oy9qr-0004s0-0h for bug-guile@gnu.org; Thu, 24 Nov 2022 05:53:05 -0500 Original-Received: from mail-vs1-xe30.google.com ([2607:f8b0:4864:20::e30]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oy9qp-00084e-En for bug-guile@gnu.org; Thu, 24 Nov 2022 05:53:04 -0500 Original-Received: by mail-vs1-xe30.google.com with SMTP id g65so834067vsc.11 for ; Thu, 24 Nov 2022 02:53:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=9sa10AxaTMSt1dxwoUOONP/31QAeGUPrPBUtG2B/xpc=; b=JpGSsoa7iatsebIoqpcuFAaOIiWe72WSE0XGBisET/e8RBZdMhG9wWyKXwnQnVjKEH w7uCB0TzFAQX+jdqWmNcOEk15CFjOKiacKSGAiQGT1QjuMK9rRrK/s4+ox/bxhgqGRw3 J41dulbKqc/Q8NxYyCRrBNE5al2SkUjLYIMr+VDdmHy3SbUNXza/aNUqFmV6G6h+XMvF xdpXVeJ4Tv/1bFaCM8NKFSyOoGP9CuY5VMpPY6IOxIl40vQwzw7T2Y8S/aODs9fqt/gr 2UfJDdLE0A/1ZXVDwNIhVvLZVdsitbpxGgm63xHSQ8JPxLpUCBH73n+UvAA7ytICNOcE /NAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=9sa10AxaTMSt1dxwoUOONP/31QAeGUPrPBUtG2B/xpc=; b=dYxSXF6BV1wfB3A6DaUIN2KvdoAx8LWPChrJr+bnvS0C4kAxoQK0lmU3HbRd9jUxRE 74ayvDDFuaCHX6dfjqf3wodrZCiw/VmFJjLAYKgz1tFzyVph3SKZtjbqhREhNIFSYt7G McajjUo6aiwtMebotsthb2rO1w4bJE1A+2FJUh8I1LF4vJacFHW9MuIeo3+TZpNuweVC S33gzTv5zdDi0vo0zuu0Ve9Dqeo7a54eUJNjfsIrnGLdEmffiB4tXtF5ap+XyqVRbr7d HTJ1DWmqloqfkhol/qsBnPYecA5Ybk+Dn4Iwn+RZC8gTHMVIhoET01/ZRPn9qVqjQDpk Sp2g== X-Gm-Message-State: ANoB5pkFuqQWYqhI+25MofXSYgIF3KaJK/iykMUlbYkLCiJ7X209tgMR XlfIQgPOerCV6jdnOkfxvuu0Zq8+wfSHLH7RzcjWAkac X-Google-Smtp-Source: AA0mqf4maAlmrQ83F92UQF9MfIvHLtN+c9EtQgGfeE4tYfcbmZi4d0a78x49E9rZDU7Cpy6oolaNURqGbhVfXwtmyUM= X-Received: by 2002:a05:6102:2906:b0:3a6:5c53:ba22 with SMTP id cz6-20020a056102290600b003a65c53ba22mr6861130vsb.82.1669287182372; Thu, 24 Nov 2022 02:53:02 -0800 (PST) Received-SPF: pass client-ip=2607:f8b0:4864:20::e30; envelope-from=jeremyphelps077@gmail.com; helo=mail-vs1-xe30.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 24 Nov 2022 06:05:55 -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:10444 Archived-At: --00000000000088939d05ee3535be Content-Type: text/plain; charset="UTF-8" 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. --00000000000088939d05ee3535be Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I lost my Emacs session today because I accidentally calle= d the length function on an extremely long = improper list.=C2=A0

But Guile prints the entire thing w= hen it=C2=A0reports the error that happens when the length function gets to= the improper part of the list. It tried to print a few million elements ju= st to tell me which list wasn't a proper list.=C2=A0

To reproduce the error should be easy:

(length
=C2=A0 = =C2=A0(let loop ((result 'x)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (n 50000000))
=C2=A0 =C2=A0 =C2=A0(if (=3D n 0)<= /div>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0resu= lt
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(loop (cons n result) (- n 1)))))

=
Emacs is more sensitive to the problem because it doesn't throw aw= ay 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,=C2=A0or to u= ninterruptibly tie up an SSH session for several minutes.

--00000000000088939d05ee3535be--