[Openmcl-devel] File-length bug?

Ron Garret ron at flownet.com
Sat Aug 3 10:53:29 PDT 2013

? (setf path #P"~/Desktop/foo")
? (setf out (open path :direction :output :if-does-not-exist :create))
#<BASIC-FILE-CHARACTER-OUTPUT-STREAM ("/Users/ron/Desktop/foo"/20 UTF-8) #x3020025DEA2D>
? (setf in (open path :direction :input))
#<BASIC-FILE-CHARACTER-INPUT-STREAM ("/Users/ron/Desktop/foo"/21 UTF-8) #x3020025DD7DD>
? (file-length in)
0                              ; As expected
? (listen in)
T                              ; Not as expected, but OK, using listen on file streams is a little hinky...
? (print 123 out)
? (force-output out)
? (file-length out)
5                               ; As expected
? (file-length in)
0                               ; Not as expected
? (file-position in 3)
? (file-position in)
? (file-length in)

Is this a bug?

FYI, what I'm actually trying to do is to use a file as a FIFO, with one process writing the file and another reading it (which is why I can't use an :io stream).  Ideally what I'd like to do is have the reader block when trying to read past the end of the file (like "tail -f"), but a reliable way of polling to see if additional data has been written would be enough.  It's a binary file, so I can't use peek-char.  (I could use flexi-streams:peek-byte but I was hoping to avoid adding a library dependency.)


More information about the Openmcl-devel mailing list