close Warning: Can't synchronize with repository "(default)" (/project/cmucl/public_html/git/cmucl.git does not appear to be a Git repository.). Look in the Trac log for more information.

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#100 closed defect (fixed)

STREAM-FILE-POSITION fails when invoked with a Gray stream

Reported by: avodonosov Owned by: rtoy
Priority: critical Milestone:
Component: Gray-streams Version: 2014-05
Keywords: Cc:


Even after you did (require :gray-streams), if you pass a Gray stream to cl:file-position, you get an error:

#<TRIVIAL-GRAY-STREAMS-TEST::TEST-STREAM {5902550D}> is an unsupported Gray stream.

You can see this error at the bottom of a trivial-gray-streams test suite:

BTW, this blocks as important library as drakma. (Old mailing list thread about this:, this error happens when drakma calls cl:file-position)

Change History (8)

comment:1 Changed 3 years ago by avodonosov

  • Component changed from Core to Gray-streams
  • Owner changed from somebody to rtoy
  • Priority changed from major to critical

comment:2 Changed 3 years ago by rtoy

I have no problems adding support for this, but I can't find any reference that file-position needs to support Gray streams. Do you have such a reference. CCL doesn't seem to list it in their docs. The cliki entry for Gray streams doesn't link to any reference that says file-position is supported.

A link would be useful.

comment:3 Changed 3 years ago by avodonosov

The Gray proposal was made before the standard was finalized, and was based on Common Lisp The Language.

The book does not have cl:file-position function, that's why (I think) the Gray proposal does not have stream-file-position. The same situation with cl:write-sequence, cl:read-sequence - they are absent in the book, and have no counterparts in the Gray proposal.

But all lisps provide gray methods for these functions. CMUCL in particular, has ext:stream-read-sequence. It is logical - Gray stream should behave as a replacement for a built-in streams; if we have some code that accepts a stream as a parameter, we should be able to pass a Gray stream as well as a built-in stream.

BTW, it is funny to see how diverged the stream-read/write-sequence become in absence of a public specification: You can see that CLISP provides stream-read-byte-sequence, stream-write-byte-sequence, stream-read-char-sequence, stream-write-char-sequence. CCL provides stream-read-vector, stream-write-vector, stream-read-list, stream-write-list :)

So, please don't be very exotic when you provide STREAM-FILE-POSITION. Desirably, similar to some other lisp.

comment:4 Changed 3 years ago by avodonosov

Submitted a CCL ticket to make their ccl::stream-position generic Gray function public -

comment:5 Changed 3 years ago by avodonosov

Ah, yes, and please keep in mind:

  • support is needed for both querying file position and changing it
  • don't forget to provide default (no-op) implementation for both cases

comment:6 Changed 3 years ago by rtoy

Thanks for the info. Very nice.

I'll try to get something in. I won't make it too exotic. :-)

comment:7 Changed 3 years ago by rtoy

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in 9e687a

comment:8 Changed 3 years ago by avodonosov

Thanks for the fix.

I opened a ticket for trivial-gray-streams to use ext:stream-file-position on CMUCL:

Note: See TracTickets for help on using tickets.