IO bug

Stas Boukarev stassats at gmail.com
Thu Jun 30 12:21:30 UTC 2016


A shorter test that shows a problem with file position:
(with-open-file (stream "/tmp/io_test.tmp"
                          :element-type '(unsigned-byte 8)
                          :direction :io
                          :if-exists :supersede
                          :if-does-not-exist :create)
    (write-byte 10 stream)
    (file-position stream 0)
    (read-byte stream)
    (let ((before (file-position stream)))
      (write-byte 1 stream)
      (values before (file-position stream))))

Returns 1 1, should have been 1 2.

On Thu, Jun 30, 2016 at 4:05 AM, Vibhu Mohindra
<vibhu.mohindra at gmail.com> wrote:
> Hallo,
>
> I've got a file open for IO. Only writing to it works okay. But if I
> also try to read from it, then things start going wrong. I've attached a
> test case that should return NIL but instead raises an error in ABCL
> (1.3.3, on OSX).
>
> The problem is with the call to #'write-sequence on line 21.
>
> In fact, from some other tests, I believe that replacing that call to
> #'write-sequence with a call to a function that does the same thing but
> by repeatedly setting the file-position and writing a byte, for each
> byte in the sequence, fixes things. That means something about
> #'write-sequence is broken.
>
> Maybe I misunderstand the file level functions in Common Lisp, and my
> test doesn't use them correctly. However, the test passes in: CLISP,
> CCL, CMUCL, SBCL, ECL. So I thought I'd report this, just in case it is
> a bug in ABCL.
>
> Also, removing the last three lines of code in #'main, which read one
> byte, makes the test run without errors.
>
> Vibhu



-- 
With best regards, Stas.



More information about the armedbear-devel mailing list