wellington / go-libsass

Go wrapper for libsass, the only Sass 3.5 compiler for Go
http://godoc.org/github.com/wellington/go-libsass
Apache License 2.0
206 stars 28 forks source link

Error marshalling fails on 32-bit systems #71

Closed QuLogic closed 5 years ago

QuLogic commented 5 years ago

I'm running a test build across all arches using 0.9.2, and it fails 3 tests on 32-bit systems (i686 and armv7hl):

--- FAIL: TestUnmarshalError (0.00s)
    encoding_test.go:78: got:  wanted: error message
--- FAIL: TestMarshalError (0.00s)
    encoding_test.go:265: got:

        wanted:
        error has been thrown
--- FAIL: TestError_simple (0.00s)
    export_test.go:28: got:  wanted: help me

These are all tests that attempt to marshal and unmarshal an error. It does not appear to matter whether I build with the bundled libsass or a system one.

drewwells commented 5 years ago

Nice finds. Those tests are basically wrappers around the libsass library. Can you reproduce those problems in that project?

QuLogic commented 5 years ago

I think I figured out the problem. The location of the value for Sass_String is one struct member later than for Sass_Error. On 64-bit systems, the two first members are packed together, but they aren't on 32-bit systems. So calling the string accessor on an error value returns garbage.