go-prompt icon indicating copy to clipboard operation
go-prompt copied to clipboard

[Bug] panic: runtime error: integer divide by zero

Open rsivasamgit opened this issue 7 months ago • 1 comments

Bug reports

We are using go-prompt and once in a while when we get into the CLI prompt, a "divide by zero" error is seen

panic: runtime error: integer divide by zero

goroutine 1 [running]: github.com/c-bata/go-prompt.(*Render).toPos(...) /go/pkg/mod/github.com/c-bata/[email protected]/render.go:269 github.com/c-bata/go-prompt.(*Render).move(0x0?, 0x0?, 0xc00006f8b8?) /go/pkg/mod/github.com/c-bata/[email protected]/render.go:258 +0xbb github.com/c-bata/go-prompt.(*Render).clear(0xc0004b8ea0, 0x17487af?) /go/pkg/mod/github.com/c-bata/[email protected]/render.go:245 +0x25 github.com/c-bata/go-prompt.(*Render).BreakLine(0xc0004b8ea0, 0xc000424140) /go/pkg/mod/github.com/c-bata/[email protected]/render.go:229 +0x22d github.com/c-bata/go-prompt.(*Prompt).feed(0xc0000e6000, {0xc0004f9800, 0x1, 0x400}) /go/pkg/mod/github.com/c-bata/[email protected]/prompt.go:124 +0x2fa github.com/c-bata/go-prompt.(*Prompt).Run(0xc0000e6000) /go/pkg/mod/github.com/c-bata/[email protected]/prompt.go:71 +0x525 bitbucket.rks-cloud.com/edge/seinfra-common-app/pkg/cobrashell.New.func1(0xc000468600?, {0x173ef40?, 0x0?, 0x0?}) /stage/pkg/cobrashell/shell.go:62 +0xf2 github.com/spf13/cobra.(*Command).execute(0xc000468600, {0x24b6e68, 0x0, 0x0}) /go/pkg/mod/github.com/spf13/[email protected]/command.go:944 +0x847 github.com/spf13/cobra.(*Command).ExecuteC(0x246d000) /go/pkg/mod/github.com/spf13/[email protected]/command.go:1068 +0x3bc github.com/spf13/cobra.(*Command).Execute(...) /go/pkg/mod/github.com/spf13/[email protected]/command.go:992

The issue is not seen always, it is seen once in every 6 attempts or so and rest of the time, the CLI renders properly

  • Operating System: Rocky Linux and K3s Pod
  • Terminal Emulator: (i.e. iTerm2)
  • tag of go-prompt or commit revision: https://github.com/c-bata/go-prompt/tree/v0.2.6

rsivasamgit avatar Nov 16 '23 11:11 rsivasamgit