BurntSushi / wingo

A fully-featured window manager written in Go.
Do What The F*ck You Want To Public License
1k stars 89 forks source link

Wingo crashes with xvncviewer+ssh #96

Open floren opened 11 years ago

floren commented 11 years ago

When starting xvncviewer from an ssh session with X forwarding enabled, Wingo will crash. It does not crash if I run xvncviewer locally. Other windows, such as xterm or even tightvncviewer, will not crash wingo when run over ssh+x forwarding. Here's the output:

    XGB: conn.go:36: Could not get authority info: EOF
    XGB: conn.go:37: Trying connection without authority info...
    WINGO WARNING: config_theme_setters.go:179: Could not get font data from '/usr/share/fonts/TTF/DejaVuSansMono-Bold.ttf' because: open /usr/share/fonts/TTF/DejaVuSansMono-Bold.ttf: no such file or directory
    WINGO WARNING: config_theme_setters.go:167: Could not load './data/minimize.png' as a png image because: open ./data/minimize.png: no such file or directory
    WINGO WARNING: config_theme_setters.go:167: Could not load './data/minimize.png' as a png image because: open ./data/minimize.png: no such file or directory
    WINGO WARNING: config_theme_setters.go:167: Could not load './data/close.png' as a png image because: open ./data/close.png: no such file or directory
    WINGO WARNING: config_theme_setters.go:167: Could not load './data/close.png' as a png image because: open ./data/close.png: no such file or directory
    WINGO WARNING: config_theme_setters.go:167: Could not load './data/maximize.png' as a png image because: open ./data/maximize.png: no such file or directory
    WINGO WARNING: config_theme_setters.go:167: Could not load './data/maximize.png' as a png image because: open ./data/maximize.png: no such file or directory
    WINGO WARNING: config_theme_setters.go:179: Could not get font data from '/usr/share/fonts/TTF/DejaVuSansMono.ttf' because: open /usr/share/fonts/TTF/DejaVuSansMono.ttf: no such file or directory
    WINGO WARNING: config_theme_setters.go:179: Could not get font data from '/usr/share/fonts/TTF/DejaVuSansMono-Bold.ttf' because: open /usr/share/fonts/TTF/DejaVuSansMono-Bold.ttf: no such file or directory
    WINGO WARNING: config_theme_setters.go:167: Could not load './data/wingo.png' as a png image because: open ./data/wingo.png: no such file or directory
    WINGO WARNING: manage.go:249: Could not find window type for window 80000D, using 'normal'.
    panic: runtime error: index out of range

    goroutine 12 [running]:
    xgb/xproto.configureWindowRequest(0xc200cd0000, 0x1000a00009, 0x7f0090c749fc, 0x0, 0x0, ...)
            /home/john/wingo/src/xgb/xproto/xproto.go:7692 +0x370
    xgb/xproto.ConfigureWindow(0xc200cd0000, 0x1000a00009, 0x7f0090c749fc, 0x0, 0x0, ...)
            /home/john/wingo/src/xgb/xproto/xproto.go:7650 +0x8c
    xgbutil/xwindow.(*Window).Configure(0xc200638bd0, 0x10, 0x0, 0x0, 0x190, ...)
            /home/john/wingo/src/xgbutil/xwindow/xwindow.go:220 +0x69e
    main.func·005(0xc2000ea280, 0xc2006362a0)
            /home/john/wingo/src/wingo/root.go:56 +0xd6
    xgbutil/xevent.ConfigureRequestFun.Run(0x8e7ed0, 0xc2000ea280, 0x7d8940, 0xc2006362a0)
            /home/john/wingo/src/xgbutil/xevent/callback.go:256 +0x5d
    xgbutil/xevent.runCallbacks(0xc2000ea280, 0x7d8940, 0xc2006362a0, 0x17, 0x286, ...)
            /home/john/wingo/src/xgbutil/xevent/xevent.go:207 +0x102
    xgbutil/xevent.processEventQueue(0xc2000ea280, 0xc200289c60, 0xc200289cc0)
            /home/john/wingo/src/xgbutil/xevent/eventloop.go:238 +0xcac
    xgbutil/xevent.mainEventLoop(0xc2000ea280, 0xc200289c60, 0xc200289cc0, 0xc200289d20)
            /home/john/wingo/src/xgbutil/xevent/eventloop.go:109 +0x97
    xgbutil/xevent.func·001()
            /home/john/wingo/src/xgbutil/xevent/eventloop.go:88 +0x4c
    created by xgbutil/xevent.MainPing
            /home/john/wingo/src/xgbutil/xevent/eventloop.go:89 +0x130

    goroutine 1 [chan receive]:
    main.main()
            /home/john/wingo/src/wingo/main.go:197 +0x886

    goroutine 2 [syscall]:

    goroutine 4 [chan send]:
    xgb.(*Conn).generateXIds(0xc200cd0000)
            /home/john/wingo/src/xgb/xgb.go:236 +0x195
    created by xgb.NewConnDisplay
            /home/john/wingo/src/xgb/xgb.go:110 +0x19e

    goroutine 5 [chan send]:
    xgb.(*Conn).generateSeqIds(0xc200cd0000)
            /home/john/wingo/src/xgb/xgb.go:258 +0x63
    created by xgb.NewConnDisplay
            /home/john/wingo/src/xgb/xgb.go:111 +0x1b5

    goroutine 6 [chan receive]:
    xgb.(*Conn).sendRequests(0xc200cd0000)
            /home/john/wingo/src/xgb/xgb.go:303 +0x63
    created by xgb.NewConnDisplay
            /home/john/wingo/src/xgb/xgb.go:112 +0x1cc

    goroutine 7 [IO wait]:
    net.runtime_pollWait(0x7f0092ca8f00, 0x72, 0x0)
            /usr/local/go/src/pkg/runtime/znetpoll_linux_amd64.c:118 +0x82
    net.(*pollDesc).WaitRead(0xc200ccb230, 0xb, 0xc200331780)
            /usr/local/go/src/pkg/net/fd_poll_runtime.go:75 +0x31
    net.(*netFD).Read(0xc200ccb1b0, 0xc200623260, 0x20, 0x20, 0x0, ...)
            /usr/local/go/src/pkg/net/fd_unix.go:195 +0x2b3
    net.(*conn).Read(0xc200cc5b28, 0xc200623260, 0x20, 0x20, 0x7f00a4ea77e8, ...)
            /usr/local/go/src/pkg/net/net.go:123 +0xc3
    io.ReadAtLeast(0xc2003317e0, 0xc200cc5b28, 0xc200623260, 0x20, 0x20, ...)
            /usr/local/go/src/pkg/io/io.go:284 +0xf7
    io.ReadFull(0xc2003317e0, 0xc200cc5b28, 0xc200623260, 0x20, 0x20, ...)
            /usr/local/go/src/pkg/io/io.go:302 +0x6f
    xgb.(*Conn).readResponses(0xc200cd0000)
            /home/john/wingo/src/xgb/xgb.go:370 +0x1f2
    created by xgb.NewConnDisplay
            /home/john/wingo/src/xgb/xgb.go:113 +0x1e3

    goroutine 9 [IO wait]:
    net.runtime_pollWait(0x7f0092ca8e60, 0x72, 0x0)
            /usr/local/go/src/pkg/runtime/znetpoll_linux_amd64.c:118 +0x82
    net.(*pollDesc).WaitRead(0xc200cca620, 0xb, 0xc200331780)
            /usr/local/go/src/pkg/net/fd_poll_runtime.go:75 +0x31
    net.(*netFD).accept(0xc200cca5a0, 0x8e8020, 0x0, 0xc200331780, 0xb, ...)
            /usr/local/go/src/pkg/net/fd_unix.go:385 +0x2c1
    net.(*UnixListener).AcceptUnix(0xc200b63240, 0x18, 0xc200b68010, 0x401197)
            /usr/local/go/src/pkg/net/unixsock_posix.go:286 +0x49
    net.(*UnixListener).Accept(0xc200b63240, 0x0, 0x0, 0x0, 0x0, ...)
            /usr/local/go/src/pkg/net/unixsock_posix.go:297 +0x49
    main.ipc(0xc2000ea280)
            /home/john/wingo/src/wingo/ipc.go:37 +0x1d9
    created by main.main
            /home/john/wingo/src/wingo/main.go:154 +0x502

    goroutine 10 [IO wait]:
    net.runtime_pollWait(0x7f0092ca8dc0, 0x72, 0x0)
            /usr/local/go/src/pkg/runtime/znetpoll_linux_amd64.c:118 +0x82
    net.(*pollDesc).WaitRead(0xc200cc86b0, 0xb, 0xc200331780)
            /usr/local/go/src/pkg/net/fd_poll_runtime.go:75 +0x31
    net.(*netFD).accept(0xc200cc8630, 0x8e8020, 0x0, 0xc200331780, 0xb, ...)
            /usr/local/go/src/pkg/net/fd_unix.go:385 +0x2c1
    net.(*UnixListener).AcceptUnix(0xc200b67320, 0xc200e7b218, 0xc200b4b6c0, 0xc200b4b720)
            /usr/local/go/src/pkg/net/unixsock_posix.go:286 +0x49
    net.(*UnixListener).Accept(0xc200b67320, 0x0, 0x0, 0x0, 0x0, ...)
            /usr/local/go/src/pkg/net/unixsock_posix.go:297 +0x49
    wingo/event.Notifier(0xc2000ea280, 0xc200b67260, 0x16)
            /home/john/wingo/src/wingo/event/ipc.go:31 +0x237
    created by main.main
            /home/john/wingo/src/wingo/main.go:157 +0x544

    goroutine 11 [select]:
    wingo/event.func·002()
            /home/john/wingo/src/wingo/event/ipc.go:134 +0x34f
    created by wingo/event.manageSubscriptions
            /home/john/wingo/src/wingo/event/ipc.go:154 +0x154

    goroutine 18 [syscall]:
    syscall.Syscall6()
            /usr/local/go/src/pkg/syscall/asm_linux_amd64.s:41 +0x5
    syscall.wait4(0x4199, 0xc20060efb0, 0x0, 0xc200ccb480, 0x100000001, ...)
            /usr/local/go/src/pkg/syscall/zerrors_linux_amd64.go:1640 +0x7b
    syscall.Wait4(0x4199, 0x7f0090c81d0c, 0x0, 0xc200ccb480, 0x3, ...)
            /usr/local/go/src/pkg/syscall/syscall_linux.go:222 +0x6c
    os.(*Process).wait(0xc20063b2c0, 0x7f0090c81d90, 0x0, 0x0)
            /usr/local/go/src/pkg/os/exec_unix.go:22 +0xea
    os.(*Process).Wait(0xc20063b2c0, 0x3, 0x5990d8, 0x8e8048)
            /usr/local/go/src/pkg/os/doc.go:43 +0x25
    os/exec.(*Cmd).Wait(0xc200642000, 0x0, 0x0)
            /usr/local/go/src/pkg/os/exec/exec.go:310 +0x197
    os/exec.(*Cmd).Run(0xc200642000, 0x4, 0x7f0090c81ec0)
            /usr/local/go/src/pkg/os/exec/exec.go:232 +0x52
    wingo/commands.func·065()
            /home/john/wingo/src/wingo/commands/commands.go:1053 +0x26d
    created by wingo/commands.Shell.Run
            /home/john/wingo/src/wingo/commands/commands.go:1061 +0xc5

    goroutine 19 [syscall]:
    syscall.Syscall()
            /usr/local/go/src/pkg/syscall/asm_linux_amd64.s:16 +0x5
    syscall.read(0xb, 0xc200644000, 0x200, 0x200, 0x800, ...)
            /usr/local/go/src/pkg/syscall/zerrors_linux_amd64.go:2337 +0x70
    syscall.Read(0xb, 0xc200644000, 0x200, 0x200, 0x41aca4, ...)
            /usr/local/go/src/pkg/syscall/syscall_unix.go:132 +0x5a
    os.(*File).read(0xc20060ef58, 0xc200644000, 0x200, 0x200, 0x6e7ce0, ...)
            /usr/local/go/src/pkg/os/file_unix.go:174 +0x60
    os.(*File).Read(0xc20060ef58, 0xc200644000, 0x200, 0x200, 0x0, ...)
            /usr/local/go/src/pkg/os/file.go:95 +0x96
    bytes.(*Buffer).ReadFrom(0xc20063c2a0, 0xc2001082a0, 0xc20060ef58, 0x0, 0x0, ...)
            /usr/local/go/src/pkg/bytes/buffer.go:169 +0x203
    io.Copy(0xc200b64960, 0xc20063c2a0, 0xc2001082a0, 0xc20060ef58, 0x0, ...)
            /usr/local/go/src/pkg/io/io.go:340 +0xa3
    os/exec.func·003(0x0, 0x0)
            /usr/local/go/src/pkg/os/exec/exec.go:207 +0x60
    os/exec.func·004(0xc20063b180)
            /usr/local/go/src/pkg/os/exec/exec.go:276 +0x2a
    created by os/exec.(*Cmd).Start
            /usr/local/go/src/pkg/os/exec/exec.go:277 +0x732
    xinit: connection to X server lost
    ^M
    Server terminated successfully (0). Closing log file.
BurntSushi commented 11 years ago

Interesting bug. I didn't try to re-create it because I have a good guess at what went wrong. But basically, there was a bug in my configure request handling code where there could be more bits set in the mask than the number of values given. The only case that could trigger that (I believe, by inspection of the code) is if the client is trying to set the border width of their window. My fix is to always explicitly ignore changes to the border width.

It working locally but not remotely is a bit strange though, so I'll hold my breath until you confirm that it's been fixed.

Note that this bug was fixed in xgbutil and not Wingo. You can update all of xgbutil like so:

go get -u github.com/BurntSushi/xgbutil/...

Note the three trailing dots. You'll then have to rebuild Wingo. (Whether by go install or go get -u github.com/BurntSushi/wingo.)

Finally, the fix is in commit https://github.com/BurntSushi/xgbutil/commit/9f9f7eded3dd5ee56ef89ff349d2f33eac0e61f1.

(If you're tracking Wingo via the AUR on Archlinux, then a reinstall should do the necessary updates.)