Opened 15 years ago

Closed 15 years ago

Last modified 14 years ago

#117 closed defect (fixed)

printing of circular objects does not terminate when shown by `describe'

Reported by: felix winkelmann Owned by: Christian Kellermann
Priority: minor Milestone:
Component: core tools Version: 4.5.x
Keywords: csi describe Cc:
Estimated difficulty:

Description

In csi, describing an object containing circular data will result in non-termination.

Attachments (2)

bug-117.diff (897 bytes) - added by Christian Kellermann 15 years ago.
bugfix proposal
circular.patch (1.4 KB) - added by Christian Kellermann 15 years ago.
improved bugfix proposal

Download all attachments as: .zip

Change History (11)

comment:1 Changed 15 years ago by felix winkelmann

Milestone: 4.3.0

comment:2 Changed 15 years ago by Christian Kellermann

Owner: set to Christian Kellermann
Status: newaccepted

Ok, testcases:

(define p '( a . b))
(set! (cdr p) p)
(define l (cons 'c p))

With the patch:
#;1> ,d l
circular list: c -> a -> a (circle)
#;2> ,d p
circular list: a -> a (circle)

I think, that this does ease the situation, although there might be cases where this does not do the right thing?

Changed 15 years ago by Christian Kellermann

Attachment: bug-117.diff added

bugfix proposal

comment:3 Changed 15 years ago by Christian Kellermann

Owner: changed from Christian Kellermann to felix winkelmann
Status: acceptedassigned

comment:4 Changed 15 years ago by felix winkelmann

Thanks! Added in e6eb2d2 (exp.).

Note thar this will still fail:

#;> (define x '(1))
#;> (set-car! x x)

comment:5 Changed 15 years ago by felix winkelmann

Keywords: csi describe added
Milestone: 4.6.0
Version: 4.2.x4.5.x

comment:6 Changed 15 years ago by Christian Kellermann

Owner: changed from felix winkelmann to Christian Kellermann

I am not sure about the best way to fix this. There are at least two ways I see:

  1. Extend circular-list? to detect circular cars
  2. Add checks for the list? and pair? cases, which would mean to either a) extend descseq and make the pair? case use that b) make a standalone check procedure and have that used also by descseq

so basically this would work the same as the code I have proposed for circular lists:
Collect all car's and check that the car's are not eq?.

comment:7 Changed 15 years ago by Christian Kellermann

The circular.patch (attached) works on lists that have its car pointing somwhere inside itself as well as its cdr (and both).

Changed 15 years ago by Christian Kellermann

Attachment: circular.patch added

improved bugfix proposal

comment:8 Changed 15 years ago by felix winkelmann

Resolution: fixed
Status: assignedclosed

Excellent. Patch is applied in 82881d88cfbf6124b83952a2482efa46a7afd59d (exp.).

Thanks!

comment:9 Changed 14 years ago by felix winkelmann

Milestone: 4.6.0

Milestone 4.6.0 deleted

Note: See TracTickets for help on using tickets.