Giter Site home page Giter Site logo

flexi-streams's People

Contributors

avodonosov avatar bakketun avatar daewok avatar darabi avatar fjl avatar gefjon avatar hanshuebner avatar jasom avatar jathd avatar jingtaozf avatar lispalien avatar loskool avatar mv2devnul avatar phmarek avatar stassats avatar vityok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flexi-streams's Issues

Probably, an error in octets-to-string

I'm having an issue converting a string with octets-to-string:
(octets-to-string #(13) :external-format '(:code-page :id 1252))

In SBCL it raises this error condition:
Invalid index 1 for (SIMPLE-VECTOR 1), should be a non-negative integer below 1.

Building with SBCL

When building decode.lisp with SBCL getting the error:
; file: /flexi-streams/decode.lisp
; in:
; DEFINE-CHAR-DECODERS (FLEXI-UTF-16-LE-FORMAT FLEXI-CR-UTF-16-LE-FORMAT FLEXI-CRLF-UTF-16-LE-FORMAT)
; (FLEXI-STREAMS::READ-NEXT-BYTE)
; --> PROG1 LET OR LET IF COND IF THE RETURN-FROM
; ==>
; NIL
;
; caught STYLE-WARNING:
; This is not a (MOD 1114112):
; NIL
; See also:
; The SBCL Manual, Node "Handling of Types"
ERROR: FAIL: SB-INT:TYPE-STYLE-WARNING 'This is not a (MOD 1114112):
NIL
See also:
The SBCL Manual, Node "Handling of Types"'

This happens for all the char-decoders that return nil, see:
(macrolet ((read-next-byte ()
`(prog1
(or octet-getter
(cond (first-octet-seen
(return-from char-decoder
(recover-from-encoding-error format
"End of data while in UTF-8 sequence.")))
(t (return-from char-decoder nil))))
(setq first-octet-seen t))))

Trying to write octets to a flexi-stream fails.

The stream is created by drakma:http-request with :force-binary t We can seen in the inspect below that it is "wellformed" AFAIK, having ELEMENT-TYPE: FLEXI-STREAMS:OCTET. But when my code sends it bytes with write-sequence, it rejects by octets, expecting characters:

debugger invoked on a TYPE-ERROR @53CD9B82 in thread #<THREAD "main thread" RUNNING {1001440113}>: The value 92 is not of type CHARACTER

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Exit debugger, returning to top level.

((:METHOD FLEXI-STREAMS::WRITE-SEQUENCE* (FLEXI-STREAMS::FLEXI-LATIN-1-FORMAT T T T T)) #<unavailable argument> #<unavailable argument> #<unavailable argument> #<unavailable argument> #<unavailable argument>) [fast-method]
   source: (CHAR-CODE CHAR-GETTER)
0] backtrace

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {1001440113}>
0: ((:METHOD FLEXI-STREAMS::WRITE-SEQUENCE* (FLEXI-STREAMS::FLEXI-LATIN-1-FORMAT T T T T)) #<unavailable argument> #<unavailable argument> #<unavailable argument> #<unavailable argument> #<unavailable argument>) [fast-method]
1: ((:METHOD TRIVIAL-GRAY-STREAMS:STREAM-WRITE-SEQUENCE (FLEXI-STREAMS:FLEXI-OUTPUT-STREAM T T T)) #<unavailable argument> #(92 59 220 141) #<unavailable argument> #<unavailable argument>) [fast-method]
2: ((SB-PCL::EMF TRIVIAL-GRAY-STREAMS:STREAM-WRITE-SEQUENCE) #<unused argument> #<unused argument> #<FLEXI-STREAMS:FLEXI-IO-STREAM {1001FAFC83}> #(92 59 220 141) 0 4)
3: ((:METHOD SB-GRAY:STREAM-WRITE-SEQUENCE (TRIVIAL-GRAY-STREAMS:FUNDAMENTAL-OUTPUT-STREAM T)) #<FLEXI-STREAMS:FLEXI-IO-STREAM {1001FAFC83}> #(92 59 220 141) 0 NIL) [fast-method]
4: (SB-IMPL::WRITE-SEQ-IMPL #(92 59 220 141) #<FLEXI-STREAMS:FLEXI-IO-STREAM {1001FAFC83}> 0 NIL)
5: (WRITE-SEQUENCE #(92 59 220 141) #<FLEXI-STREAMS:FLEXI-IO-STREAM {1001FAFC83}> :START 0 :END NIL)
6: ((:METHOD SEND-OCTETS (STREAM T)) #<FLEXI-STREAMS:FLEXI-IO-STREAM {1001FAFC83}> #(92 59 220 141) :START 0 :END NIL) [fast-method]
7: ((SB-PCL::EMF SEND-OCTETS) #<unused argument> #<unused argument> #<FLEXI-STREAMS:FLEXI-IO-STREAM {1001FAFC83}> #(92 59 220 141))
8: ((:METHOD CL-NAIVE-WEBSOCKETS::WRITE-FRAME (T CL-NAIVE-WEBSOCKETS::FRAME)) #<FLEXI-STREAMS:FLEXI-IO-STREAM {1001FAFC83}> #<CL-NAIVE-WEBSOCKETS::FRAME {1006695E43}>) [fast-method]
9: ((:METHOD CL-NAIVE-WEBSOCKETS::SEND-FRAME (WEBSOCKETS-ENDPOINT CL-NAIVE-WEBSOCKETS::FRAME)) #<WEBSOCKETS-CLIENT-ENDPOINT {10058355F3}> #<CL-NAIVE-WEBSOCKETS::FRAME {1006695E43}>) [fast-method]
10: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN CL-NAIVE-WEBSOCKETS::SEND-MESSAGE))
11: ((FLET "WITHOUT-INTERRUPTS-BODY-1" :IN SB-THREAD::CALL-WITH-MUTEX))
12: (SB-THREAD::CALL-WITH-MUTEX #<FUNCTION (FLET SB-THREAD::WITH-MUTEX-THUNK :IN CL-NAIVE-WEBSOCKETS::SEND-MESSAGE) {235721B}> #<SB-THREAD:MUTEX "websockets-endpoint %send-message-lock" owner: #<SB-THREAD:THREAD "main thread" RUNNING {1001440113}>> T NIL)
13: ((:METHOD CL-NAIVE-WEBSOCKETS::SEND-MESSAGE (WEBSOCKETS-ENDPOINT T T T)) #<WEBSOCKETS-CLIENT-ENDPOINT {10058355F3}> 1 #() NIL) [fast-method]
14: ((:METHOD SEND-TEXT-MESSAGE (WEBSOCKETS-ENDPOINT T)) #<WEBSOCKETS-CLIENT-ENDPOINT {10058355F3}> "" :MAY-FRAGMENT NIL) [fast-method]
15: ((SB-PCL::EMF SEND-TEXT-MESSAGE) #<unused argument> #<unused argument> #<WEBSOCKETS-CLIENT-ENDPOINT {10058355F3}> "")
16: ((FLET "G0" :IN CHAT))
17: (CHAT #<WEBSOCKETS-CLIENT-ENDPOINT {10058355F3}>)
18: (WS-CHAT-CLIENT "localhost" 1236 "/ws" :SECURE NIL :SUBPROTOCOL "chat" :ORIGIN NIL)
19: (RUN-CLIENT "localhost" 1236 "/ws" NIL "chat" NIL)
...



8: ((:METHOD CL-NAIVE-WEBSOCKETS::WRITE-FRAME (T CL-NAIVE-WEBSOCKETS::FRAME)) #<FLEXI-STREAMS:FLEXI-IO-STREAM {1001FAFC83}> #<CL-NAIVE-WEBSOCKETS::FRAME {1006695E43}>) [fast-method]
8] list-locals
CL-NAIVE-WEBSOCKETS::DATA  =  #()
CL-NAIVE-WEBSOCKETS::FIRST-BYTE  =  129
CL-NAIVE-WEBSOCKETS::FRAME  =  #<CL-NAIVE-WEBSOCKETS::FRAME {1006695E43}>
CL-NAIVE-WEBSOCKETS::LEN  =  0
CL-NAIVE-WEBSOCKETS::LOWER-LAYER  =  #<FLEXI-STREAMS:FLEXI-IO-STREAM {1001FAFC83}>
CL-NAIVE-WEBSOCKETS::MASKING-KEY  =  #(92 59 220 141)
CL-NAIVE-WEBSOCKETS::PAYLOAD-LENGTH  =  0
CL-NAIVE-WEBSOCKETS::SECOND-BYTE  =  128

8] (inspect CL-NAIVE-WEBSOCKETS::LOWER-LAYER)

The object is a STANDARD-OBJECT of type FLEXI-STREAMS:FLEXI-IO-STREAM.
0. OPEN-P: T
1. STREAM: #<CHUNGA:CHUNKED-IO-STREAM {1001FACCD3}>
2. EXTERNAL-FORMAT: #<FLEXI-STREAMS::FLEXI-LATIN-1-FORMAT (:ISO-8859-1 :EOL-STYLE :LF) {100739F7C3}>
3. ELEMENT-TYPE: FLEXI-STREAMS:OCTET
4. COLUMN: NIL
5. LAST-CHAR-CODE: NIL
6. LAST-OCTET: NIL
7. OCTET-STACK: NIL
8. POSITION: 415
9. BOUND: NIL
> q

8] (write-sequence #(92 59 220 141)  CL-NAIVE-WEBSOCKETS::LOWER-LAYER)


debugger invoked on a TYPE-ERROR @53CD9B82 in thread #<THREAD "main thread" RUNNING {1001440113}>: The value 92 is not of type CHARACTER

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [ABORT] Reduce debugger level (to debug level 1).
  1:         Exit debugger, returning to top level.

((:METHOD FLEXI-STREAMS::WRITE-SEQUENCE* (FLEXI-STREAMS::FLEXI-LATIN-1-FORMAT T T T T)) #<unavailable argument> #<unavailable argument> #<unavailable argument> #<unavailable argument> #<unavailable argument>) [fast-method]
   source: (CHAR-CODE CHAR-GETTER)
0[2] 

Warnings issued when building with SBCL

Trying to build with SBCL this morning (sbcl-1.4.5.206-df9c9da6f), I get an warning, which ASDF promotes to an error:

; caught WARNING:
; Derived type of
; (RETURN-FROM CHAR-DECODER NIL)
; in
; "a hairy form"
; is
; (VALUES NULL &OPTIONAL),
; conflicting with their asserted type
; (MOD 1114112).
; See also:
; The SBCL Manual, Node "Handling of Types"

this occurs when trying to compile decode.lisp, but there are so many other style warnings that it's a bit of a challenge to figure out at precisely which line the error (warning) is occurring.

flexi-stream not of type stream on ABCL

Concatenating flexi-streams on ABCL leads to a type error.

ABCL 1.5.0
flexi-streams 1.0.15

CL-USER(3): (make-concatenated-stream (flexi-streams:make-flexi-stream
                                    (make-string-input-stream "foo")))

#<THREAD "interpreter" {34317C33}>: Debugger invoked on condition of type TYPE-ERROR
  org.armedbear.lisp.StandardObject@74751ac8 is not an input stream.
Restarts:
  0: TOP-LEVEL Return to top level.

flexi-streams:output-stream-sequence-length

(defun example ()
(let ((outmem (flexi-streams:make-in-memory-output-stream)))
(write-sequence '(72 101 108 108 111) outmem)
(flexi-streams:output-stream-sequence-length outmem)))

The value #(72 101 108 108 111)
is not of type
(SIMPLE-ARRAY * (*)).
[Condition of type TYPE-ERROR]

Restarts:
0: [RETRY] Retry SLIME REPL evaluation request.
1: [*ABORT] Return to SLIME's top level.
2: [ABORT] abort thread (#<THREAD "new-repl-thread" RUNNING {1009D843B3}>)

Backtrace:
0: ((:METHOD FLEXI-STREAMS:OUTPUT-STREAM-SEQUENCE-LENGTH (FLEXI-STREAMS:IN-MEMORY-OUTPUT-STREAM)) #) [fast-method]
[No Locals]
1: (EXAMPLE)

if I comment the (the (simple-array * (*)) out, the error is gone:

(defmethod output-stream-sequence-length ((stream in-memory-output-stream))
"Returns the current length of the underlying vector of the
IN-MEMORY output stream STREAM."
(declare (optimize speed))
(with-accessors ((vector vector-stream-vector))
stream
(length ;(the (simple-array * (*))
vector)));)
Helmut

Using FORMAT with a flexi-stream produces wrong format ~T directives

Hello,

I am sorry if this question is irrelevant to flexi-streams, but in my understanding of the problem I tracked down the issue to flexi-streams.

My goal is to write to the stream returned by HUNCHENTOOT:SEND-HEADERS. As specified in the document this is a binary stream, so I use a flexi-stream to write to it.

Given stream as the flexi-stream instance writing to the underlying binary stream, I use FORMAT like this:

(format stream "~&Last Update:~12T~A~%" date)
(format stream "~&Value:~12T~A~%" value)

Unfortunately doing so discards the formatting that would have been done by the ~12T format directive.

Is there something wrong with flexi-streams? Although it works as expected, I would like to avoid writing to a string-output-stream.

Best,
Camille

Probably, an error in octets-to-string

I'm having an issue converting a string with octets-to-string:
(octets-to-string #(13) :external-format '(:code-page :id 1252))

In SBCL it raises this error condition:
Invalid index 1 for (SIMPLE-VECTOR 1), should be a non-negative integer below 1.

In the release 1.0.15 the function didn't raise an exception (it returned "^M"). The error condition raised now, seems to be about accessing past the end of the vector.

Poor performance?

Hi folks,

I'm working on a toy project that involves encoding/decoding some binary data, and I happened to notice that using flexi-streams' in-memory streams is much much slower vs. reading/writing from a binary file. Just wondering if there is any reason for this weirdness. Here is a simple test function (it'll output like 50M into a file in /tmp/).

(ql:quickload '("trivial-utf-8" "flexi-streams"))

(defmacro mytime (title &body body)
  `(progn
     (format t "Timing: ~A~%" ,title)
     (time ,@body)))

(defun test-flexi-streams (&optional (filename "/tmp/flexistreams.bin"))
  (let* ((str "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ăşţîâĂŞŢÎÂ")
         (size (trivial-utf-8:utf-8-byte-length str))
         (times 500000)
         (sequence))
    (mytime "write to built-in stream"
      (with-open-file (output filename :element-type '(unsigned-byte 8)
                                       :direction :output
                                       :if-does-not-exist :create
                                       :if-exists :supersede)
        (loop repeat times
              do (trivial-utf-8:write-utf-8-bytes str output))))

    (mytime "write to flexi in-memory stream"
      (let ((output (flexi-streams:make-in-memory-output-stream)))
        (loop repeat times
              do (trivial-utf-8:write-utf-8-bytes str output))
        (setf sequence (flexi-streams:get-output-stream-sequence output))))

    (mytime "read from built-in stream"
      (with-open-file (input filename :element-type '(unsigned-byte 8))
        (loop repeat times
              do (trivial-utf-8:read-utf-8-string input :byte-length size))))

    (mytime "read from in-memory stream"
      (let ((input (flexi-streams:make-in-memory-input-stream sequence)))
        (loop repeat times
              do (trivial-utf-8:read-utf-8-string input :byte-length size))))))

Results here look like this:

Timing: write to built-in stream
Evaluation took:
  0.336 seconds of real time
  0.334568 seconds of total run time (0.291399 user, 0.043169 system)
  99.70% CPU
  601,427,574 processor cycles
  0 bytes consed
  
Timing: write to flexi in-memory stream
Evaluation took:
  2.256 seconds of real time
  2.256795 seconds of total run time (2.256746 user, 0.000049 system)
  [ Real times consist of 0.003 seconds GC time, and 2.253 seconds non-GC time. ]
  [ Run times consist of 0.001 seconds GC time, and 2.256 seconds non-GC time. ]
  100.04% CPU
  4,058,053,884 processor cycles
  134,180,240 bytes consed
  
Timing: read from built-in stream
Evaluation took:
  0.566 seconds of real time
  0.567083 seconds of total run time (0.543763 user, 0.023320 system)
  [ Real times consist of 0.003 seconds GC time, and 0.563 seconds non-GC time. ]
  [ Run times consist of 0.001 seconds GC time, and 0.567 seconds non-GC time. ]
  100.18% CPU
  1,019,238,246 processor cycles
  448,008,624 bytes consed
  
Timing: read from in-memory stream
Evaluation took:
  3.040 seconds of real time
  3.033796 seconds of total run time (3.027243 user, 0.006553 system)
  [ Real times consist of 0.003 seconds GC time, and 3.037 seconds non-GC time. ]
  [ Run times consist of 0.001 seconds GC time, and 3.033 seconds non-GC time. ]
  99.80% CPU
  5,456,326,518 processor cycles
  447,991,600 bytes consed

I'm using SBCL 2.3.9.63-23c796775.

I'm not sure something can be done about it, but if it's possible to improve, I guess a lot of projects will benefit. In my case I'm forced to ditch flexi-streams for now; the difference is so big that if I have the data in memory, I'm better off dumping it into a file and read it back from there, rather than going through in-memory-input-stream.

string output stream?

Hey all,

One feature I tend to miss often is the ability to have a stream output to a string with a fill-pointer ala with-output-to-string, but with indefinite extent so I can keep it around.

I see this is missing even from flexi-streams, with the same issue where you have flexi-streams:with-output-to-sequence, but no way to make-output-to-sequence.

Any thoughts on an addition like that? I was going to write my own function making use of flexi-streams::vector-output-stream, as that's what make-in-memory-output-stream uses, but I see that's not an exported symbol.

:description

Would you please consider adding a :description option to your system definition of flex-streams?

stream-file-position should not call stream-file-position for underlying stream, but cl:file-position

(defmethod stream-file-position ((stream flexi-stream))
  "Dispatch to method for underlying stream."
  (declare #.*standard-optimize-settings*)
  (with-accessors ((stream flexi-stream-stream))
      stream
    (stream-file-position stream)))

(defmethod (setf stream-file-position) (position-spec (stream flexi-stream))
  "Dispatch to method for underlying stream."
  (declare #.*standard-optimize-settings*)
  (with-accessors ((stream flexi-stream-stream))
      stream
    (setf (stream-file-position stream) position-spec)))

Here flexi-streams calls trivial-gray-streams:stream-file-position for the underlying stream. But we don't know whether the underlying stream is a gray stream or a "native" stream. It worked only by coincedence due to how trivial-gray-streams and lisp 'native' streams of lisp implementations are coded.

It's more correct to call just cl:file-position.

Why doesn't the setter method STREAM-FILE-POSITION update POSITION?

In addition to dispatching to the underlying stream's setter method, why doesn't STREAM-FILE-POSITION update it's own notion of POSITION? (see marked XXX below):

(defmethod (setf stream-file-position) (position-spec (stream flexi-stream))
  "Dispatch to method for underlying stream."
  (declare #.*standard-optimize-settings*)
  (setf (flexi-stream-position stream) position-spec) ;;; XXX
  (with-accessors ((stream flexi-stream-stream))
      stream
    (setf (stream-file-position stream) position-spec)))

flexi-stream-position not updated after read-sequence

What the title says, this occurs on SBCL for me. A mini example to reproduce:

(with-open-file (in "non-empty-file" :element-type '(unsigned-byte 8))
  (setq in (make-flexi-stream in))
  (let ((out (make-array 1 :element-type '(unsigned-byte 8))))
    (read-sequence out in :end 1)
    (flexi-stream-position in)))

This returns 0 while 1 is expected. If I use read-byte instead of read-sequence, then everything works fine.

Undefined STREAM var?

It looks like stream is undefined here:

(defmethod unread-byte (byte (flexi-input-stream flexi-input-stream))
  "Similar to UNREAD-CHAR in that it `unreads' the last octet from
STREAM.  Note that you can only call UNREAD-BYTE after a corresponding
READ-BYTE."
  (declare #.*standard-optimize-settings*)
  (with-accessors ((last-octet flexi-stream-last-octet)
                   (octet-stack flexi-stream-octet-stack)
                   (position flexi-stream-position))
      flexi-input-stream
    (unless last-octet
      (error 'flexi-stream-error
             :stream stream
             :format-control "No byte to unread from this stream \(or last reading operation read a character)."))
    (unless (= byte last-octet)
      (error 'flexi-stream-error
             :stream stream
             :format-control "Last byte read was different from #x~X."
             :format-arguments (list byte)))
    (setq last-octet nil)
    (decf (the integer position))
    (push byte octet-stack)
    nil))

Should it be flexi-input-stream?

peek-char method of flexi-streams:in-memory-stream

Hi guys, I am trying to run JSON parser (yason:parse) with flexi-streams:in-memory-stream directly, because (yason:parse) can accept string steam input directly.

Then SBCL gives me the error when I did it. After checking the code of yason::parse and the error message, I found there are two generic functions of SBCL that needed to be implemented: SB-GRAY:STREAM-READ-CHAR and SB-GRAY:STREAM-PEEK-CHAR

So I tried to implement by code:

(defmethod SB-GRAY:STREAM-READ-CHAR ((s flexi-streams:in-memory-stream))
  (code-char (read-byte s)))

(defmethod SB-GRAY:STREAM-PEEK-CHAR ((s flexi-streams:in-memory-stream))
  (let ((char (code-char (flexi-streams:peek-byte s))))
    char))

Then yason:parse works fine with flexi-streams:in-memory-stream (at least now).

Do you guys trying to implement peek-char for flexi-streams:in-memory-stream? My code just work, I am not sure I met all hidden details of flexi-streams:in-memory-stream. It would be nice if flexi-stream has peek-char natively.

Thanks

:POSITION/:BOUND broken on current Quicklisp version

Preparation:

CL-USER> (alexandria:write-byte-vector-into-file 
          (coerce #(0 1 2 3 4 5 6 7 8 9) '(vector (unsigned-byte 8)))
          #p"/tmp/bytes")
#(0 1 2 3 4 5 6 7 8 9)

Bug:

CL-USER> (with-open-file (stream #p"/tmp/bytes" :element-type '(unsigned-byte 8)
                                                :direction :input)
           (let ((flexi-stream (flex:make-flexi-stream stream :position 0 :bound 4
                                                              :element-type '(unsigned-byte 8)))
                 (output (make-array 10 :initial-element 0)))
             (read-sequence output flexi-stream)
             output))
#(0 1 2 3 0 0 0 0 0 0)

CL-USER> (with-open-file (stream #p"/tmp/bytes" :element-type '(unsigned-byte 8)
                                                :direction :input)
           (let ((flexi-stream (flex:make-flexi-stream stream :position 4 :bound 8
                                                              :element-type '(unsigned-byte 8)))
                 (output (make-array 10 :initial-element 0)))
             (read-sequence output flexi-stream)
             output))
#(0 1 2 3 0 0 0 0 0 0)

In the last case, I expected #(4 5 6 7 0 0 0 0 0 0) instead.

Tests broken on SBCL 2.4.4

$ sbcl --version
SBCL 2.4.4
$ sbcl --script <<<'(load "./quicklisp/setup.lisp") (ql:quickload "flexi-streams") (asdf:test-system "flexi-streams")'
To load "flexi-streams":
  Load 1 ASDF system:
    flexi-streams
; Loading "flexi-streams"

WARNING:
   Deprecated recursive use of (ASDF/OPERATE:OPERATE 'ASDF/LISP-ACTION:LOAD-OP
   '("flexi-streams-test")) while visiting
   (ASDF/LISP-ACTION:TEST-OP "flexi-streams") - please use proper dependencies
   instead
Test suite: "Reading/writing files"
Unhandled TYPE-ERROR in thread #<SB-THREAD:THREAD tid=59625 "main thread" RUNNING
                                  {10003E8143}>:
  The value
    #<error printing a FIXNUM: #<TYPE-ERROR expected-type: REAL
                                            datum: (error printing condition)>>

  is not of type
    CONS

Backtrace for: #<SB-THREAD:THREAD tid=59625 "main thread" RUNNING {10003E8143}>
0: (FLEXI-STREAMS-TEST::CREATE-TEST-COMBINATIONS "kafka" (:UTF8 :LATIN1 :CP1252) NIL)
1: (FLEXI-STREAMS-TEST::COMPARE-FILES :VERBOSE NIL)
2: (FLEXI-STREAMS-TEST:RUN-ALL-TESTS :VERBOSE NIL)
3: ((SB-PCL::EMF ASDF/ACTION:PERFORM) #<unused argument> #<unused argument> #<ASDF/LISP-ACTION:TEST-OP > #<ASDF/SYSTEM:SYSTEM "flexi-streams">)
4: ((LAMBDA NIL :IN ASDF/ACTION:CALL-WHILE-VISITING-ACTION))
5: ((:METHOD ASDF/ACTION:PERFORM-WITH-RESTARTS :AROUND (T T)) #<ASDF/LISP-ACTION:TEST-OP > #<ASDF/SYSTEM:SYSTEM "flexi-streams">) [fast-method]
6: ((:METHOD ASDF/PLAN:PERFORM-PLAN (T)) #<ASDF/PLAN:SEQUENTIAL-PLAN {10022ED323}>) [fast-method]
7: ((FLET SB-C::WITH-IT :IN SB-C::%WITH-COMPILATION-UNIT))
8: ((:METHOD ASDF/PLAN:PERFORM-PLAN :AROUND (T)) #<ASDF/PLAN:SEQUENTIAL-PLAN {10022ED323}>) [fast-method]
9: ((:METHOD ASDF/OPERATE:OPERATE (ASDF/OPERATION:OPERATION ASDF/COMPONENT:COMPONENT)) #<ASDF/LISP-ACTION:TEST-OP > #<ASDF/SYSTEM:SYSTEM "flexi-streams"> :PLAN-CLASS NIL :PLAN-OPTIONS NIL) [fast-method]
10: ((SB-PCL::EMF ASDF/OPERATE:OPERATE) #<unused argument> #<unused argument> #<ASDF/LISP-ACTION:TEST-OP > #<ASDF/SYSTEM:SYSTEM "flexi-streams">)
11: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
12: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) #<ASDF/LISP-ACTION:TEST-OP > #<ASDF/SYSTEM:SYSTEM "flexi-streams">) [fast-method]
13: ((SB-PCL::EMF ASDF/OPERATE:OPERATE) #<unused argument> #<unused argument> ASDF/LISP-ACTION:TEST-OP "flexi-streams")
14: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
15: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) ASDF/LISP-ACTION:TEST-OP "flexi-streams") [fast-method]
16: (ASDF/SESSION:CALL-WITH-ASDF-SESSION #<FUNCTION (LAMBDA NIL :IN ASDF/OPERATE:OPERATE) {10022D46EB}> :OVERRIDE T :KEY NIL :OVERRIDE-CACHE T :OVERRIDE-FORCING NIL)
17: ((LAMBDA NIL :IN ASDF/OPERATE:OPERATE))
18: (ASDF/SESSION:CALL-WITH-ASDF-SESSION #<FUNCTION (LAMBDA NIL :IN ASDF/OPERATE:OPERATE) {10022CA87B}> :OVERRIDE NIL :KEY NIL :OVERRIDE-CACHE NIL :OVERRIDE-FORCING NIL)
19: ((:METHOD ASDF/OPERATE:OPERATE :AROUND (T T)) ASDF/LISP-ACTION:TEST-OP "flexi-streams") [fast-method]
20: (ASDF/OPERATE:TEST-SYSTEM "flexi-streams")
21: (SB-INT:SIMPLE-EVAL-IN-LEXENV (ASDF/OPERATE:TEST-SYSTEM "flexi-streams") #<NULL-LEXENV>)
22: (EVAL-TLF (ASDF/OPERATE:TEST-SYSTEM "flexi-streams") NIL NIL)
23: ((LABELS SB-FASL::EVAL-FORM :IN SB-INT:LOAD-AS-SOURCE) (ASDF/OPERATE:TEST-SYSTEM "flexi-streams") NIL)
24: (SB-INT:LOAD-AS-SOURCE #<SB-SYS:FD-STREAM for "standard input" {10003E83F3}> :VERBOSE NIL :PRINT NIL :CONTEXT "loading")
25: ((LABELS SB-FASL::LOAD-STREAM-1 :IN LOAD) #<SB-SYS:FD-STREAM for "standard input" {10003E83F3}> NIL)
26: (SB-FASL::CALL-WITH-LOAD-BINDINGS #<FUNCTION (LABELS SB-FASL::LOAD-STREAM-1 :IN LOAD) {7F3F23C6779B}> #<SB-SYS:FD-STREAM for "standard input" {10003E83F3}> NIL #<SB-SYS:FD-STREAM for "standard input" {10003E83F3}>)
27: (LOAD #<SB-SYS:FD-STREAM for "standard input" {10003E83F3}> :VERBOSE NIL :PRINT NIL :IF-DOES-NOT-EXIST :ERROR :EXTERNAL-FORMAT :DEFAULT)
28: ((FLET SB-IMPL::LOAD-SCRIPT :IN SB-IMPL::PROCESS-SCRIPT) #<SB-SYS:FD-STREAM for "standard input" {10003E83F3}>)
29: ((FLET SB-UNIX::BODY :IN SB-IMPL::PROCESS-SCRIPT))
30: ((FLET "WITHOUT-INTERRUPTS-BODY-" :IN SB-IMPL::PROCESS-SCRIPT))
31: (SB-IMPL::PROCESS-SCRIPT T)
32: (SB-IMPL::TOPLEVEL-INIT)
33: ((FLET SB-UNIX::BODY :IN SB-IMPL::START-LISP))
34: ((FLET "WITHOUT-INTERRUPTS-BODY-3" :IN SB-IMPL::START-LISP))
35: (SB-IMPL::%START-LISP)

unhandled condition in --disable-debugger mode, quitting
;
; compilation unit aborted
;   caught 1 fatal ERROR condition

SBCL 2.4.4 and flexi-streams 4951d57

The tests pass on SBCL 2.4.3.

Setting flexi-stream-position has no effect on the next byte read

Running

(with-open-file (in "2-byte-file" :element-type '(unsigned-byte 8))
  (setq in (make-flexi-stream in))
  (setf (flexi-stream-position in) 1)
  (read-byte in))

returns the first byte, while I would expect the second byte. This happens on SBCL for me. I don't know if it's a bug or intended behavior, however in the latter case might be good to update the documentation.

How do convert to a string or byte array?

So this is probably a stupid question and this is the wrong place to ask. But I was using the clack web library for lisp, and if I POST a file with it, I get an instance of FLEXI-STREAMS::VECTOR-INPUT-STREAM (and an associated error because I'm treating it like a string). I don't know how to do anything with that and the docs aren't exactly illuminating. I could read-byte over and over again, but that seems inefficient to say the least. How can I do this?

README mentions CL-INTERPOL

Complete documentation for CL-INTERPOL can be found (...)

This likely means flexi-streams instead of cl-interpol.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.