peterh / liner

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

panic: runtime error: integer divide by zero #88

Closed karalabe closed 7 years ago

karalabe commented 7 years ago

Running on MIPS32/OpenWRT, liner crashes hard:

panic: runtime error: integer divide by zero

goroutine 506 [running]:
github.com/ethereum/go-ethereum/vendor/github.com/peterh/liner.(*State).refreshMultiLine(0x572a48c0, 0x58503d3c, 0x2, 0x20, 0x58503cbc, 0x1, 0x20, 0x1, 0x10000, 0x1)
    /ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/peterh/liner/line.go:159 +0x4e8
github.com/ethereum/go-ethereum/vendor/github.com/peterh/liner.(*State).refresh(0x572a48c0, 0x58503d3c, 0x2, 0x20, 0x58503cbc, 0x1, 0x20, 0x1, 0x54821c, 0xa202020)
    /ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/peterh/liner/line.go:95 +0x84
github.com/ethereum/go-ethereum/vendor/github.com/peterh/liner.(*State).PromptWithSuggestion(0x572a48c0, 0xe69ba2, 0x2, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0)
    /ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/peterh/liner/line.go:961 +0x710
github.com/ethereum/go-ethereum/vendor/github.com/peterh/liner.(*State).Prompt(0x572a48c0, 0xe69ba2, 0x2, 0x57e49670, 0x460d40, 0x57e49640, 0xb9fdc0)
    /ext-go/1/src/github.com/ethereum/go-ethereum/vendor/github.com/peterh/liner/line.go:563 +0x58
github.com/ethereum/go-ethereum/console.(*terminalPrompter).PromptInput(0x57540460, 0xe69ba2, 0x2, 0x0, 0x0, 0x0, 0x0)
    /ext-go/1/src/github.com/ethereum/go-ethereum/console/prompter.go:116 +0xbc
github.com/ethereum/go-ethereum/console.(*Console).Interactive.func1(0x573fcc00, 0x57e49640, 0x579ec2b8, 0x58753280, 0x579ec2c0)
    /ext-go/1/src/github.com/ethereum/go-ethereum/console/console.go:298 +0x84
created by github.com/ethereum/go-ethereum/console.(*Console).Interactive
    /ext-go/1/src/github.com/ethereum/go-ethereum/console/console.go:312 +0x128

It seems for some reason that liner believes the console width is 0 characters.

peterh commented 7 years ago

Should be fixed in current master. Please test and let me know.