+
+;; don't break fd-stream external-format support:
+
+(deftest external-format-1
+ (progn
+ (with-open-file (s *test-file*
+ :direction :output
+ :if-exists :supersede
+ :element-type '(unsigned-byte 8))
+ (write-byte 195 s)
+ (write-byte 132 s))
+ (with-open-file (s *test-file*
+ :direction :input
+ :external-format :utf-8)
+ (char-code (read-char s))))
+ 196)
+
+;; launchpad bug #491087
+
+(deftest lp491087
+ (labels ((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
+ (merge-pathnames #P"lp491087.txt" *test-path*)
+ :class 'file-simple-stream)
+ (let* ((start (file-position stream))
+ (integer (read-big-int stream))
+ (end (file-position stream)))
+ (and (= start 0)
+ (= integer #x30313233)
+ (= end 4)))))
+ T)