You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have already raised this with the yaml library here, hoping to narrow down the issue, but unfortunately the project doesn't seem to be terribly active. However I don't see how this problem could be the fault of the library.
What version of Go are you using (go version)?
go version go1.8rc3 linux/amd64
What operating system and processor architecture are you using (go env)?
// plugin.gopackage main
import"gopkg.in/yaml.v2"funcGo() {
varbazmap[string]stringyaml.Unmarshal([]byte("foo: bar"), &baz)
}
# Makefilebuild: clean
@go build -buildmode=plugin -o plugin.so plugin.go
@go build -o main main.go
clean:
@rm -rf main *.so
Build and run the executable with make && ./main.
What did you expect to see?
The program should complete successfully.
What did you see instead?
The following panic:
panic: expected end of document event but got 7 [recovered]
panic: expected end of document event but got 7
goroutine 1 [running]:
plugin/vendor/gopkg.in/yaml%2ev2.handleErr(0xc420053ed8)
/home/oliver/workspace/src/plugin/vendor/gopkg.in/yaml.v2/yaml.go:153 +0x95
panic(0x5a0c80, 0xc4200106e0)
/nix/store/nz3j87ls421358ks5bd24dgq9c8z59sn-go-1.8-dev/share/go/src/runtime/panic.go:489 +0x2e7
plugin/vendor/gopkg.in/yaml%2ev2.(*parser).document(0xc4200be000, 0x7f24b3c8a144)
/home/oliver/workspace/src/plugin/vendor/gopkg.in/yaml.v2/decode.go:141 +0x203
plugin/vendor/gopkg.in/yaml%2ev2.(*parser).parse(0xc4200be000, 0x5d3ce8)
/home/oliver/workspace/src/plugin/vendor/gopkg.in/yaml.v2/decode.go:116 +0x100
plugin/vendor/gopkg.in/yaml%2ev2.Unmarshal(0xc4200106a0, 0x8, 0x8, 0x59a360, 0xc4200ac6c8, 0x0, 0x0)
/home/oliver/workspace/src/plugin/vendor/gopkg.in/yaml.v2/yaml.go:84 +0x177
plugin/unnamed-8517ae4ac6807292a59c508315fef6ff06256b82.Go()
/home/oliver/workspace/src/plugin/plugin.go:7 +0x9e
main.main()
/home/oliver/workspace/src/plugin/main.go:9 +0xaa
The ordering of the yaml.Unmarshal() calls between the executable and the plugin doesn't seem to matter, but it does have to be called from both.
Tracing through the code, it seems that the plugin takes a completely different (and wrong) codepath when provided with the same input, and at certain points it changes when adding a simple fmt.Printf().
The text was updated successfully, but these errors were encountered:
I have already raised this with the yaml library here, hoping to narrow down the issue, but unfortunately the project doesn't seem to be terribly active. However I don't see how this problem could be the fault of the library.
What version of Go are you using (
go version
)?go version go1.8rc3 linux/amd64
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/oliver/workspace"
GORACE=""
GOROOT="/nix/store/nz3j87ls421358ks5bd24dgq9c8z59sn-go-1.8-dev/share/go"
GOTOOLDIR="/nix/store/nz3j87ls421358ks5bd24dgq9c8z59sn-go-1.8-dev/share/go/pkg/tool/linux_amd64"
GCCGO="/nix/store/jm8nf0p2n6m092385kmb87zxhanxigvc-gccgo49-wrapper-4.9.4/bin/gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/run/user/1000/go-build507203162=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
What did you do?
Build and run the executable with
make && ./main
.What did you expect to see?
The program should complete successfully.
What did you see instead?
The following panic:
The ordering of the
yaml.Unmarshal()
calls between the executable and the plugin doesn't seem to matter, but it does have to be called from both.Tracing through the code, it seems that the plugin takes a completely different (and wrong) codepath when provided with the same input, and at certain points it changes when adding a simple
fmt.Printf()
.The text was updated successfully, but these errors were encountered: