dnephin / dobi

A build automation tool for Docker applications
https://dnephin.github.io/dobi/
Apache License 2.0
309 stars 36 forks source link

Runtime terminfo panic when running dobi #135

Closed stumoss closed 6 years ago

stumoss commented 6 years ago

Hi,

There seems to be an issue when running dobi (version 0.11) which is caused by the Nveen/Gotty library dependency. It appears that getting the terminfo can cause a panic on some systems. Unfortunately this issue is known about and there is an open pull request Nvveen/Gotty/pull/2 which should fix the issue but it was opened on 6th April 2017 and hasn't been merged by the author. It seems like the Docker community also saw this issue and have since vendored Gotty and applied the fix locally moby/moby/issues/32400.

I suggest that it might be worth vendoring Gotty and applying the patch or alternatively iph/Gotty could be used as this is a fork of Gotty with the required patch applied.

The specific error message I was seeing when using dobi can be seen below (I was using NixOS 18.03 at the time but have also seen it on Ubuntu 17.10):

panic: runtime error: index out of range

goroutine 20 [running]:
github.com/dnephin/dobi/vendor/github.com/Nvveen/Gotty.readTermInfo(0xc4200231a0, 0x15, 0x0, 0x0, 0x0)
       /go/src/github.com/dnephin/dobi/vendor/github.com/Nvveen/Gotty/gotty.go:232 +0xcc4
github.com/dnephin/dobi/vendor/github.com/Nvveen/Gotty.OpenTermInfo(0xc420020025, 0x5, 0xc420020025, 0x5, 0xc4203b4a47)
       /go/src/github.com/dnephin/dobi/vendor/github.com/Nvveen/Gotty/gotty.go:45 +0x261
github.com/dnephin/dobi/vendor/github.com/docker/docker/pkg/jsonmessage.DisplayJSONMessagesStream(0x978b60, 0xc4201c57e8, 0x979000, 0xc42000c018, 0x1, 0x67b201, 0x0, 0x0, 0x0)
       /go/src/github.com/dnephin/dobi/vendor/github.com/docker/docker/pkg/jsonmessage/jsonmessage.go:263 +0x53c
github.com/dnephin/dobi/tasks/image.Stream.func1(0xc4201c57e8, 0x979000, 0xc42000c018, 0x1, 0x1, 0xc420212c60)
       /go/src/github.com/dnephin/dobi/tasks/image/image.go:74 +0x71
created by github.com/dnephin/dobi/tasks/image.Stream
       /go/src/github.com/dnephin/dobi/tasks/image/image.go:73 +0x243

Awesome tool by the way!

dnephin commented 6 years ago

Fixed in #132, but I guess I forgot to do a patch release with the fix. I'll try to do that soon

Enteee commented 6 years ago

:+1: hitting this issue here as well, a using TERM=linux dobi as an ugly workaround atm.

stumoss commented 6 years ago

Awesome :+1:

dnephin commented 6 years ago

I guess I had tagged a release, but the CI job failed. The release is up on github now: https://github.com/dnephin/dobi/releases/tag/v0.11.1

Thanks for reporting the problem!