fasl-write problem with records because of struct-type-field-names

Bug #194259 reported by Derick Eddington
2
Affects Status Importance Assigned to Milestone
Ikarus Scheme
Fix Committed
Medium
Abdulaziz Ghuloum

Bug Description

Ikarus Scheme version 0.0.3+ (revision 1403, build 2008-02-21)
Copyright (c) 2006-2008 Abdulaziz Ghuloum

> (define-record-type my-thing (fields x))
> (define t0 (make-my-thing 123))
> (define-values (bvop bvop-getter) (open-bytevector-output-port))
> (fasl-write t0 bvop)
Unhandled exception
 Condition components:
   1. &assertion
   2. &who: struct-type-field-names
   3. &message: "not an rtd"
   4. &irritants: (#<record-type-descriptor my-thing>)
>

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

Will fix. There are also a few things the fasl-read procedure cannot read yet (some number types I think). Will fix those too.

Changed in ikarus:
assignee: nobody → aghuloum
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

Fixed in rev 1405.

> (let ()
    (define-record-type my-thing (fields x))
    (define t0 (make-my-thing 123))
    (let-values ([(bvop bvop-getter) (open-bytevector-output-port)])
      (fasl-write t0 bvop)
      (let ([bv (bvop-getter)])
        (for-each
          (lambda (n) (printf "~x~x" (div n 16) (mod n 16)))
          (bytevector->u8-list bv))
        (newline)
        (let ([obj (fasl-read (open-bytevector-input-port bv))])
          (list t0 obj (and (my-thing? obj) (my-thing-x obj)))))))
2340494B30317B01000000574D73080000006D792D7468696E67464773020000006730731000000046246A392F35242F4C5877324A47395A46464904000000464D73010000007849EC010000
(#[my-thing 123] #[my-thing 123] 123)

Changed in ikarus:
status: Confirmed → Fix Committed
Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

That output was too ugly. Here's a fix.

> (let ()
    (import (hexdump))
    ;;; from https://code.launchpad.net/~aghuloum/ikarus-libraries/r6rs-hexdump
    (define-record-type my-thing (fields x))
    (define t0 (make-my-thing 123))
    (let-values ([(bvop bvop-getter) (open-bytevector-output-port)])
      (fasl-write t0 bvop)
      (let ([bv (bvop-getter)])
        (hexdump bv)
        (let ([obj (fasl-read (open-bytevector-input-port bv))])
          (list t0 obj (and (my-thing? obj) (my-thing-x obj)))))))
0x00000000 23 40 49 4B 30 31 7B 01 00 00 00 57 4D 73 08 00 | #@IK01{....WMs.. |
0x00000010 00 00 6D 79 2D 74 68 69 6E 67 46 47 73 02 00 00 | ..my-thingFGs... |
0x00000020 00 67 30 73 10 00 00 00 6B 55 44 78 39 30 55 35 | .g0s....kUDx90U5 |
0x00000030 59 57 3E 76 6B 71 3D 58 46 46 49 04 00 00 00 46 | YW>vkq=XFFI....F |
0x00000040 4D 73 01 00 00 00 78 49 EC 01 00 00 | Ms....xI.... |
(#[my-thing 123] #[my-thing 123] 123)

Changed in ikarus:
milestone: none → 0.0.4
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.