peterh / liner

Pure Go line editor with history, inspired by linenoise
MIT License
1.04k stars 132 forks source link

influx CLI requires stty col > 0 #76

Closed chicagozer closed 8 years ago

chicagozer commented 8 years ago

Running influx in a docker container, I came across this issue. The terminal configured was extremely basic and apparently had no screen size defined in stty.

`InfluxDB shell version: 0.13.0

panic: runtime error: integer divide by zero [signal 0x8 code=0x1 addr=0x61f870 pc=0x61f870] goroutine 1 [running]: panic(0x786fa0, 0xc82000a060) /usr/local/go/src/runtime/panic.go:481 +0x3e6 github.com/peterh/liner.(*State).refreshMultiLine(0xc8200823c0, 0xc8200ed410, 0x2, 0x2, 0xc82000b910, 0x1, 0x2, 0x1, 0x0, 0x0) /root/go/src/github.com/peterh/liner/line.go:159 +0xf0`

  • Complete sample that reproduces the bug ensure stty has col = 0; enter CLI and press a key

influxdb@deis-monitor-influxdb-4qttw:~$ stty -a speed 38400 baud; rows 0; columns 0; line = 0;

peterh commented 8 years ago

Was this not fixed by #75 82a939e738b0ee23e84ec7a12d8e216f4d95c53f ? Which commit of liner did you test with?

peterh commented 8 years ago

Upon closer inspection, this was probably caused by #75. @jsternberg could you please take a look at this?

jsternberg commented 8 years ago

Yea, I can. @chicagozer if this happens only with the docker container, can you open this issue against influxdata/influxdata-docker instead? If it happens with the main application too, please open it against influxdata/influxdb.

chicagozer commented 8 years ago

@jsternberg I believe it will happen any time col = 0 in stty. I have reported this to the deis team using influxdb but thought I would mention it here in case anyone else came across the problem.

chicagozer commented 8 years ago

looks like https://github.com/peterh/liner/pull/75 already fixes this. Thanks!

jsternberg commented 8 years ago

Ok, if that fixed it, then that's good. #75 should be included in influxdb 0.13 so, if you still experience the problem with that version, please open a bug so that I can investigate it and report it to @peterh if it's a library issue or an influxdb issue. Thanks!