abcl icon indicating copy to clipboard operation
abcl copied to clipboard

Possible issue with ABCL reading saved clos objects

Open Slids opened this issue 5 years ago • 3 comments

This was found in regards to: https://github.com/qitab/cl-protobufs/pull/236

First we run protoc on alias-test.proto which creates the form: (proto:define-message aliased-message
(:conc-name ""
:alias-for my.dog.has.fleas::aliased-struct)
;; Fields
(i
:index 1 :type proto:int32 :kind :scalar :label (:optional) :json-name "i"))

When we then try to load this with cl-protobufs it expands the macro creating a clos message descriptor:

#<CL-PROTOBUFS:MESSAGE-DESCRIPTOR ALIASED-MESSAGE (alias for MY.DOG.HAS.FLEAS::AL
IASED-STRUCT) {C0DEFC1}>

and then a call to save it: (COMMON-LISP:PROGN (COMMON-LISP:DEFTYPE ALIASED-MESSAGE ()
'COMMON-LISP:T)
(PROTOBUFS-IMPLEMENTATION::RECORD-PROTOBUF-OBJECT 'MY.DOG.HAS.FLEAS::ALIASED-STRUCT
#<CL-PROTOBUFS:MESSAGE-DESCRIPTOR ALIASED-MESSAGE (alias for MY.DOG.HAS.FLEAS::AL
IASED-STRUCT) {C0DEFC1}>
:MESSAGE)
(PROTOBUFS-IMPLEMENTATION::RECORD-PROTOBUF-OBJECT 'ALIASED-MESSAGE
#<CL-PROTOBUFS:MESSAGE-DESCRIPTOR ALIASED-MESSAGE (alias for MY.DOG.HAS.FLEAS::AL
IASED-STRUCT) {C0DEFC1}>
:MESSAGE))

Later we call (assert-eq
(proto:find-message 'pb:aliased-message)
(proto:find-message 'my.dog.has.fleas::aliased-struct)))

and get a failure. Pringting out the result of (proto:find-message 'pb:aliased-message) we get structurally equivalent messages with different pointers. This works in SBCL and CCL.

Slids avatar Sep 19 '20 19:09 Slids

Alright, I'll take a look when I get a chance.

easye avatar Sep 19 '20 20:09 easye

I'm having trouble getting the protoc compiler machinery working under macOS/FreeBSD, i.e. on non-Linux environments where I can't install a protobuf protoc under /usr/local/. I'll eventually figure this out, but for now I am getting errors on the ASDF compilation phase:

Failed to compile proto file.  Command: "protoc --proto_path=/Users/evenson/common-lisp/cl-protobufs/google/protobuf/:/Users/evenson/common-lisp/cl-protobufs/google/protobuf/ --lisp_out=output-file=type.lisp:/Users/evenson/.cache/common-lisp/abcl-1.8.0-fasl43-macosx-x64/Users/evenson/common-lisp/cl-protobufs/ /Users/evenson/common-lisp/cl-protobufs/google/protobuf/type.proto --experimental_allow_proto3_optional"

This looks like it is trying to write type.lisp to the ASDF fasl cache.

I'll have more time tomorrow, as I want to get cl-protobufs humming nicely for abcl-1.8.0.

easye avatar Oct 14 '20 18:10 easye

Tangentially there was a break to cl-protobufs ABCL CI, we missed a quote. https://github.com/qitab/cl-protobufs/pull/260 fixes it. A little confused why this passes for SBCL and CCL but fails for ABCL...

Slids avatar Oct 15 '20 04:10 Slids