stream output corrupt
SBCL writes the wrong data to output streams when write(2) returns a smaller value
than the total number of bytes requested. I see the problem with I/O to socket streams
where the stream has serve-event equal to NIL.
The bug is in flush-output-buffer in file fd-stream.lisp.
When sb!unix:unix-write returns a value for count that is less than length,
the code loops and tries to write again after waiting for the file descriptor
to become usable. The length for the second write is recomputed
as (- tail head), but head has not been changed to account for the data
already written. The attached patch fixes the problem.
(:ASDF2 :ASDF :ASDF-UNIX :SB-XREF-
:SB-DOC :SB-TEST :SB-LDB :SB-PACKAGE-LOCKS :SB-UNICODE :SB-EVAL
:LARGEFILE :GENCGC :STACK-
:CYCLE-COUNTER :COMPLEX-FLOAT-VOPS :FLOAT-EQL-VOPS :INLINE-CONSTANTS