[flexi-streams-devel] Flexi-streams problem with SBCL 1.0.34

Edi Weitz edi at agharta.de
Thu Jan 7 21:28:44 UTC 2010


I'm not familiar with ironclad or zs3.  Could you maybe send a full
backtrace and a simple way to reproduce the problem?

Thanks,
Edi.


On Thu, Jan 7, 2010 at 9:29 PM, Fred Gibson <fred at streamfocus.com> wrote:
> I found a problem with the flexi-streams:string-to-octets function.  I
> was getting the following back-trace when using it:
>
> (ironclad:make-hmac (string-octets key) :sha1)  from zs3:make-digester gives:
>
> The value #(55 98 50 52 104 75 97 65 50 54 ...)
> is not of type
>  (SIMPLE-ARRAY (UNSIGNED-BYTE 8) (*)).
>  [Condition of type TYPE-ERROR]
>
> Restarts:
>  0: [DEFAULT-DEBUGGER] Use default debugger.
>  1: [ABORT] Return to SLIME's top level.
>  2: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread"
> RUNNING {ACA40D1}>)
>
> Backtrace:
>  0: ((SB-PCL::FAST-METHOD SHARED-INITIALIZE :AFTER (IRONCLAD::HMAC
> T)) #<unavailable argument> #<unavail..
>    Locals:
>      SB-DEBUG::ARG-0 = 10
>      SB-DEBUG::ARG-1 = :<NOT-AVAILABLE>
>      SB-DEBUG::ARG-2 = :<NOT-AVAILABLE>
>      SB-DEBUG::ARG-3 = #<HMAC(SHA1) {F0DD561}>
>      SB-DEBUG::ARG-4 = :<NOT-AVAILABLE>
>  1: ((LAMBDA (SB-PCL::|.P0.| SB-PCL::|.P1.| SB-PCL::|.P2.|))
> #<unavailable argument> #<unavailable argum..
>    Locals:
>      SB-DEBUG::ARG-0 = :<NOT-AVAILABLE>
>      SB-DEBUG::ARG-1 = :<NOT-AVAILABLE>
>      SB-DEBUG::ARG-2 = :<NOT-AVAILABLE>
>
> zs3's string-octets uses flexi-streams:string-to-octets
>
> The workaround I'm using for now is instead going to acl-compat's
> string-to-octets function from acl-excl.lisp:
>
> (defun string-to-octets (string &key (null-terminate t) (start 0)
>                       end mb-vector make-mb-vector?
>                       (external-format :default))
>  "This function returns a lisp-usb8-vector and the number of bytes copied."
>  (declare (ignore external-format))
>  ;; The end parameter is different in ACL's lambda list, but this
>  ;; variant lets us give an argument :end nil explicitly, and the
>  ;; right thing will happen
>  (unless end (setf end (length string)))
>  (let* ((number-of-octets (if null-terminate (1+ (- end start))
>                             (- end start)))
>       (mb-vector (cond
>                    ((and mb-vector (>= (length mb-vector) number-of-octets))
>                     mb-vector)
>                    ((or (not mb-vector) make-mb-vector?)
>                     (make-array (list number-of-octets)
>                                 :element-type '(unsigned-byte 8)
>                                 :initial-element 0))
>                    (t (error "Was given a vector of length ~A, ~
>                               but needed at least length ~A."
>                              (length mb-vector) number-of-octets)))))
>  (declare (type (simple-array (unsigned-byte 8) (*)) mb-vector))
>  (loop for from-index from start below end
>     for to-index upfrom 0
>     do (progn
>          (setf (aref mb-vector to-index)
>                (char-code (aref string from-index)))))
>  (when null-terminate
>    (setf (aref mb-vector (1- number-of-octets)) 0))
>  (values mb-vector number-of-octets)))
>
> which seems to work fine.
>
> My best,
>
> Fred Gibson
>
> Founder / Software Developer
> http://www.streamfocus.com
>
> (c)2010 Organon Technologies LLC
>
> _______________________________________________
> flexi-streams-devel mailing list
> flexi-streams-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/flexi-streams-devel
>
>




More information about the Flexi-streams-devel mailing list