GNU bug report logs - #51412
29.0.50; cl--mapcar-many fails inconsistently in the presence of circular lists; other shortcomings

Previous Next

Package: emacs;

Reported by: akater <nuclearspace <at> gmail.com>

Date: Tue, 26 Oct 2021 12:02:02 UTC

Severity: normal

Found in version 29.0.50

Full log


View this message in rfc822 format

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: akater <nuclearspace <at> gmail.com>
Cc: 51412 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: bug#51412: 29.0.50; cl--mapcar-many fails inconsistently in the presence of circular lists; other shortcomings
Date: Wed, 14 Sep 2022 20:38:45 +0200
akater <nuclearspace <at> gmail.com> writes:

> cl--mapcar-many is used as a backend for implementing several cl-
> functions in cl-extra.  To deal with arbitrary number of arguments
> (passed to cl--mapcar-many as list cl-seq), it goes through them all
> whenever there are more than 2, in advance, and attempts to compute the
> minimal length.
>
> This fails if any of the arguments is a circular list.
>
> To reproduce, just evaluate (cl-map 'list #'identity '#1=(a . #1#) nil nil).

Debugger entered--Lisp error: (circular-list (a . #2))

> Note that (cl-map 'list #'identity '#1=(a . #1#) nil) doesn't fail so
> this is at the very least inconsistent.  N.B.: CL spec says “Should be
> prepared to signal an error” for improper lists for such functions.
> Long story short, this means circular lists can be supported by CL
> implementations according to CL spec.

It's inconsistent, so that should probably be fixed.  But isn't
signalling an error here the right thing to do?  But I guess as long as
not all the lists are circular, then it's fine to return something
here...

Perhaps Stafan has some comments; added to the CCs.




This bug report was last modified 2 years and 275 days ago.

Previous Next


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