walles / moar

Moar is a pager. It's designed to just do the right thing without any configuration.
Other
676 stars 19 forks source link

moar 1.28 crashed #254

Closed ciscohack closed 2 weeks ago

ciscohack commented 3 weeks ago

while doing grep moar got crashed with below traceback

Please post the following report at <https://github.com/walles/moar/issues>,
or e-mail it to johan.walles@gmail.com.

Version: v1.28.1
LANG   : en_US.UTF-8
TERM   : tmux-256color
MOAR   : -colors=16M --render-unprintable=whitespace -mousemode=select
EDITOR :

GOOS    : darwin
GOARCH  : arm64
Compiler: gc
NumCPU  : 12

panic: runtime error: index out of range [-1] [recovered]
        panic: runtime error: index out of range [-1] [recovered]
        panic: runtime error: index out of range [-1]

goroutine 1 [running]:
main.main.func1()
        github.com/walles/moar/moar.go:575 +0x150
panic({0x10328d1e0?, 0x14000120240?})
        runtime/panic.go:785 +0x124
main.startPaging.func1()
        github.com/walles/moar/moar.go:629 +0x114
panic({0x10328d1e0?, 0x14000120240?})
        runtime/panic.go:785 +0x124
github.com/walles/moar/m.(*Pager).decorateLine(0x14000118000, 0x140002462d8, {0x1400052e240, 0x7, 0x7}, {0x140002462d0, 0x0, {0x102ff0323, 0x5}, 0x1, ...})
        github.com/walles/moar/m/screenLines.go:362 +0xba4
github.com/walles/moar/m.(*Pager).renderLine(0x14000118000, 0x1400051fc38, {0x0}, {0x140002462d0, 0x0, {0x102ff0323, 0x5}, 0x1, {0x0, 0x0, ...}})
        github.com/walles/moar/m/screenLines.go:240 +0x264
github.com/walles/moar/m.(*scrollPositionInternal).handlePositiveDeltaScreenLines(0x14000118020, 0x14000118000)
        github.com/walles/moar/m/scrollPosition.go:142 +0xc0
github.com/walles/moar/m.(*scrollPositionInternal).canonicalize(0x14000118020, 0x14000118000)
        github.com/walles/moar/m/scrollPosition.go:255 +0x198
github.com/walles/moar/m.(*Pager).lineNumber(...)
        github.com/walles/moar/m/scrollPosition.go:277
github.com/walles/moar/m.(*Pager).renderLines(0x14000118000)
        github.com/walles/moar/m/screenLines.go:118 +0x64
github.com/walles/moar/m.(*Pager).renderScreenLines(0x14000118000)
        github.com/walles/moar/m/screenLines.go:77 +0x28
github.com/walles/moar/m.(*Pager).redraw(0x14000118000, {0x0, 0x0})
        github.com/walles/moar/m/screenLines.go:42 +0x4c
github.com/walles/moar/m.(*Pager).StartPaging(0x14000118000, {0x1032a6218, 0x140000be070}, 0x1400020f3e0, 0x14000450af0)
        github.com/walles/moar/m/pager.go:384 +0x300
main.startPaging(0x14000010280?, {0x1032a6218?, 0x140000be070?}, 0x1032a1390?, 0x14000030001?)
        github.com/walles/moar/moar.go:647 +0x54
main.main()
        github.com/walles/moar/moar.go:600 +0x230
walles commented 2 weeks ago

Has this happened once or more than once?

Do you have a way to reproduce this?

I've been staring at it for a while now and having a repro case would be super!

ciscohack commented 2 weeks ago

I did cat | ug 'pattern' | ug 'pattern' when crash happen here my ugrep app is using moar as pager and cat is aliased to bat.. but i am now not able to reproduced

walles commented 2 weeks ago

This might be fixed in this release: https://github.com/walles/moar/releases/tag/v1.28.2

Since you can't repro and I can't repro I'm assuming this is because of some race condition.

And v1.28.2 fixes two race conditions.

So I'm crossing my fingers one of them was causing this.

Thanks for reporting @ciscohack!

ciscohack commented 2 weeks ago

This might be fixed in this release: https://github.com/walles/moar/releases/tag/v1.28.2

Since you can't repro and I can't repro I'm assuming this is because of some race condition.

And v1.28.2 fixes two race conditions.

So I'm crossing my fingers one of them was causing this.

Thanks for reporting @ciscohack!

thank you so much my friend you are really a champion