input and output buffers get out of sync in io streams
Bug #1600610 reported by
Guillaume LE VAILLANT
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Triaged
|
High
|
Unassigned |
Bug Description
(with-open-file (stream "/tmp/foo"
(write-string "abc" stream)
(file-position stream 0)
(write-char #\x stream)
(read-char stream))
=> #\a
summary: |
- read-sequence can move file-position beyond end of file + input and output buffers get out of sync in io streams |
description: | updated |
Changed in sbcl: | |
status: | New → Triaged |
importance: | Undecided → High |
tags: | added: streams |
To post a comment you must log in.
Flushing the output buffer by hand before reading seems to work.
(with-open-file (stream "string.txt"
:direction :io
:if- exists :overwrite
:if- does-not- exist :create)
(write-string "abc" stream)
(file-position stream 0)
(write-char #\d stream)
(finish-output stream)
(read-char stream))
=> #\b
Maybe the code for flushing the output buffer before reading in the case of a file stream opened in io mode is missing...