BurntSushi / xgbutil

A utility library to make use of the X Go Binding easier. (Implements EWMH and ICCCM specs, key binding support, etc.)
Do What The F*ck You Want To Public License
195 stars 45 forks source link

LookupString segfault on linux #51

Open lolbinarycat opened 4 years ago

lolbinarycat commented 4 years ago

output:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5911be]

goroutine 19 [running]:
testing.tRunner.func1.1(0x5b4dc0, 0x733ee0)
        /usr/lib/go-1.15/src/testing/testing.go:1057 +0x30d
testing.tRunner.func1(0xc000082900)
        /usr/lib/go-1.15/src/testing/testing.go:1060 +0x41a
panic(0x5b4dc0, 0x733ee0)
        /usr/lib/go-1.15/src/runtime/panic.go:969 +0x175
github.com/BurntSushi/xgbutil/keybind.KeysymGetWithMap(...)
        /home/binarycat/go/src/github.com/BurntSushi/xgbutil/keybind/keybind.go:260
github.com/BurntSushi/xgbutil/keybind.KeysymGet(...)
        /home/binarycat/go/src/github.com/BurntSushi/xgbutil/keybind/keybind.go:251
github.com/BurntSushi/xgbutil/keybind.interpretSymList(0xc0000fa140, 0x5ab836, 0x620101, 0xc000129e98, 0x59200d, 0x9, 0xc000129e80, 0x7208c0, 0x5ebcfd, 0x4)
        /home/binarycat/go/src/github.com/BurntSushi/xgbutil/keybind/encoding.go:87 +0x3e
github.com/BurntSushi/xgbutil/keybind.LookupString(0xc0000fa140, 0x360010, 0x4, 0x6c68b0)
        /home/binarycat/go/src/github.com/BurntSushi/xgbutil/keybind/encoding.go:34 +0x3e
github.com/lolbinarycat/dprefix.GetString(0x5f525ef0, 0xc000030770)
        /home/binarycat/go/src/github.com/lolbinarycat/dprefix/main.go:30 +0x8c
github.com/lolbinarycat/dprefix.TestGetString(0xc000082900)
        /home/binarycat/go/src/github.com/lolbinarycat/dprefix/main_test.go:27 +0x26
testing.tRunner(0xc000082900, 0x5fd808)
        /usr/lib/go-1.15/src/testing/testing.go:1108 +0xef
created by testing.(*T).Run
        /usr/lib/go-1.15/src/testing/testing.go:1159 +0x386

uname -a:

Linux binarycat 4.19.0-10-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) x86_64 GNU/Linux

go env:

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/binarycat/.cache/go-build"
GOENV="/home/binarycat/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/binarycat/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/binarycat/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.15"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.15/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build338105219=/tmp/go-build -gno-record-gcc-switches"
lolbinarycat commented 4 years ago

SOLVED: I wasn't running keybind.Initialize. Maybe this requirement should be documented somewhere?