[Openmcl-devel] peek-char advances the file-position
Gary Byers
gb at clozure.com
Wed Apr 4 00:41:57 PDT 2012
On Wed, 4 Apr 2012, Pascal J. Bourguignon wrote:
[Calling PEEK-CHAR on a FILE-STREAM changes the value returned by FILE-POSITION.]
A simple test case:
(with-open-file (f "some-file")
(loop
(let* ((before (file-position f))
(ch (peek-char nil f nil nil))
(after (file-position f)))
(when (null ch) (return))
(unless (eql before after)
(error "PEEK-CHAR changed file position from ~s to ~s." before after))
(read-char f)))
errors on the first iteration (and would show that the file position changes
on every iteration if the test was changed to simply print that fact.) That's
been present for a few years, and there doesn't seem to be anything very subtle
about it.
That should be fixed in the trunk in r15292 and (after a bit of smoke-testing)
should probably be propagated to the 1.8 branch as well.
More information about the Openmcl-devel
mailing list