Steel Bank Common Lisp

Problem with read-vector of simple streams

Reported by Christophe Rhodes on 2009-12-01
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Low
Nathan Froyd

Bug Description

Report from bb 4spam

 affects sbcl
 status confirmed
 importance low
 tag sb-simple-streams patch contribs streams
 done

With SBCL-1.0.18, the file position is 5 after a call of the function
read-vector with a simple array of one '(signed-byte 32). I would
expect 4.

Here is how to reproduce :

;;(asdf:operate 'asdf:load-op :sb-simple-streams)

(defpackage streams-test
  (:use #:common-lisp #:sb-simple-streams))

(in-package #:streams-test)

(defun read-big-int (stream)
  (let ((b (make-array 1 :element-type '(signed-byte 32) :initial-element 0)))
    (declare (dynamic-extent b))
    (sb-simple-streams::read-vector b stream :endian-swap :network-order)
    (aref b 0)))

(with-open-file (stream "anyfile.txt" :class 'file-simple-stream)
  (print (file-position stream))
  (print (read-big-int stream))
  (print (file-position stream)))

The problem has been fixed in CMUCL :
http://common-lisp.net/cgi-bin/viewcvs.cgi/src/pcl/simple-streams/impl.lisp?root=cmucl&r1=1.6&r2=1.7

I'm attaching a patch adapted for sbcl.

Is it the right way to do?

Ben

Nathan Froyd (froydnj) wrote :

I will apply this to the next release.

Changed in sbcl:
assignee: nobody → Nathan Froyd (froydnj)
Nathan Froyd (froydnj) wrote :

Fix committed in 1.0.35.8.

Changed in sbcl:
status: Confirmed → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers