Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moar version 1.30.0 crashed on macOS #259

Open
ciscohack opened this issue Dec 9, 2024 · 15 comments
Open

moar version 1.30.0 crashed on macOS #259

ciscohack opened this issue Dec 9, 2024 · 15 comments

Comments

@ciscohack
Copy link

ciscohack commented Dec 9, 2024

moar crash with follow syntax search and freeze at crash prompt

 ug 'stuck' asa.txt | ug 'loop'                                                                                                                                                                                           ✔
^[[?1049h^[[?1006;1000l^[[?25l^[]11;?^GPlease post the following report at <https://github.com/walles/moar/issues>,
or e-mail it to [email protected].

Version: v1.30.0
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:598 +0x150
panic({0x1046b9560?, 0x14000134498?})
        runtime/panic.go:785 +0x124
main.startPaging.func1()
        github.com/walles/moar/moar.go:652 +0x114
panic({0x1046b9560?, 0x14000134498?})
        runtime/panic.go:785 +0x124
github.com/walles/moar/m.(*Pager).decorateLine(0x1400028a000, 0x140004481e0, {0x14000482480, 0x7, 0x7}, {0x140004481d8, 0x0, {0x104406a71, 0x5}, 0x1, ...})
        github.com/walles/moar/m/screenLines.go:362 +0xba4
github.com/walles/moar/m.(*Pager).renderLine(0x1400028a000, 0x1400035e260, {0x0}, {0x140004481d8, 0x0, {0x104406a71, 0x5}, 0x1, {0x0, 0x0, ...}})
        github.com/walles/moar/m/screenLines.go:240 +0x27c
github.com/walles/moar/m.(*scrollPositionInternal).handlePositiveDeltaScreenLines(0x1400028a020, 0x1400028a000)
        github.com/walles/moar/m/scrollPosition.go:142 +0xc0
github.com/walles/moar/m.(*scrollPositionInternal).canonicalize(0x1400028a020, 0x1400028a000)
        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(0x1400028a000)
        github.com/walles/moar/m/screenLines.go:118 +0x64
github.com/walles/moar/m.(*Pager).renderScreenLines(0x1400028a000)
        github.com/walles/moar/m/screenLines.go:77 +0x28
github.com/walles/moar/m.(*Pager).redraw(0x1400028a000, {0x0, 0x0})
        github.com/walles/moar/m/screenLines.go:42 +0x4c
github.com/walles/moar/m.(*Pager).StartPaging(0x1400028a000, {0x1046d2638, 0x1400015c0e0}, 0x1400035e0c0, 0x1400048f430)
        github.com/walles/moar/m/pager.go:350 +0x2d0
main.startPaging(0x14000112230?, {0x1046d2638?, 0x1400015c0e0?}, 0x1046cd750?, 0x14000170001?)
        github.com/walles/moar/moar.go:670 +0x54
main.main()
        github.com/walles/moar/moar.go:623 +0x234
@walles
Copy link
Owner

walles commented Dec 19, 2024

I've been able to reproduce this crash in a test by setting the screen width to 0.

Seems you are in tmux, is that right?

I wonder what would make tmux report zero width terminal...

@ciscohack
Copy link
Author

ciscohack commented Dec 19, 2024

I've been able to reproduce this crash in a test by setting the screen width to 0.

Seems you are in tmux, is that right?

I wonder what would make tmux report zero width terminal...

Yes i am using tmux.. not sure on terminal part

@walles
Copy link
Owner

walles commented Dec 19, 2024

Inside the tmux session where this crash happens:

  1. Does this crash happen every time or does it sometimes work?
  2. What if you just view some file in moar like moar /etc/services, does that also crash?
  3. Can you try tput cols and post the output here?
  4. Which terminal program are you using?

It's strange that you see ^[[?1049h^[[?1006;1000l^[[?25l^[]11;?^G, which is part of moar's terminal init sequence.

Kind of like something blocking moar from talking to the terminal.

@ciscohack
Copy link
Author

@walles

=> I tried 2 times and crash happened 2 times then i didn't tried.
=> tried moar /etc/services and this didn't cause crash
=> tput cols result output 172
=> i am using iterm2

walles added a commit that referenced this issue Dec 31, 2024
Relates to #259.

I don't understand how this could happen, but this should at least
take us closer to the source.
walles added a commit that referenced this issue Dec 31, 2024
To improve diagnoability of #259.
@walles
Copy link
Owner

walles commented Dec 31, 2024

Do you have a .ugrep config file?

If you do, could you share it here?

@ciscohack
Copy link
Author

Do you have a .ugrep config file?

If you do, could you share it here?

bkp.ugrep.zip

Here you go

walles added a commit that referenced this issue Jan 1, 2025
For improved debugability of #259.
@walles
Copy link
Owner

walles commented Jan 1, 2025

Do you have a ~/.tmux.conf or a /etc/tmux file?

If you could upload those here as well I'd like to have a look!

@ciscohack
Copy link
Author

ciscohack commented Jan 1, 2025

Do you have a ~/.tmux.conf or a /etc/tmux file?

If you could upload those here as well I'd like to have a look!

https://github.com/gpakosz/.tmux

this is what i am using just minor keybinding change nothing else ..so you can use this

@ciscohack

This comment was marked as outdated.

@ciscohack

This comment was marked as resolved.

walles added a commit that referenced this issue Jan 5, 2025
@walles
Copy link
Owner

walles commented Jan 5, 2025

Can you repro with v1.31.0? And put the crash message in this ticket?

https://github.com/walles/moar/releases/tag/v1.31.0

The crash message in this release contains more information that I hope will tell me something about what's going on.

@ciscohack
Copy link
Author

Can you repro with v1.31.0? And put the crash message in this ticket?

https://github.com/walles/moar/releases/tag/v1.31.0

The crash message in this release contains more information that I hope will tell me something about what's going on.

I am running moar v1.31.1 now and i am now travelling will be away from my system for longer duration

@ciscohack
Copy link
Author

ciscohack commented Jan 7, 2025

some how i got access to my system and tested 1.31.0 and issue is still there

or e-mail it to [email protected].

Version: v1.31.0
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

Stdin  is a terminal: false
Stdout is a terminal: true

time="Jan  7 11:16:40.873573" level=info msg="Input stream is assumed to be uncompressed"
time="Jan  7 11:16:40.874763" level=info msg="ttyin terminal state: &{state:{termios:{Iflag:10240 Oflag:2 Cflag:19200 Lflag:67 Cc:[4 255 255 127 23 21 18 255 3 28 26 25 17 19 22 15 1 0 20 255] Ispeed:9600 Ospeed:9600}}}"
time="Jan  7 11:16:40.874777" level=info msg="ttyout terminal state: &{state:{termios:{Iflag:10240 Oflag:2 Cflag:19200 Lflag:67 Cc:[4 255 255 127 23 21 18 255 3 28 26 25 17 19 22 15 1 0 20 255] Ispeed:9600 Ospeed:9600}}}"
time="Jan  7 11:16:40.874915" level=info msg="Entering Twin main loop..."
time="Jan  7 11:16:40.875382" level=info msg="Pager starting"
time="Jan  7 11:16:40.875433" level=info msg="Entering pager main loop..."
time="Jan  7 11:16:40.875468" level=info msg="ttyin read error, twin giving up: EOF"

Panic recovery timestamp: 2025-01-07 11:16:40.875592 +0530 IST m=+0.020610126

panic: Got zero screen size: 0 x 0 [recovered]
        panic: Got zero screen size: 0 x 0 [recovered]
        panic: Got zero screen size: 0 x 0

goroutine 1 [running]:
main.main.func1()
        github.com/walles/moar/moar.go:610 +0x200
panic({0x10131ba60?, 0x14000306280?})
        runtime/panic.go:785 +0x124
main.startPaging.func1()
        github.com/walles/moar/moar.go:665 +0x114
panic({0x10131ba60?, 0x14000306280?})
        runtime/panic.go:785 +0x124
github.com/walles/moar/twin.(*UnixScreen).Size(0x1400023c000)
        github.com/walles/moar/twin/screen.go:574 +0x208
github.com/walles/moar/twin.(*UnixScreen).Clear(0x1400023c000)
        github.com/walles/moar/twin/screen.go:684 +0x80
github.com/walles/moar/m.(*Pager).redraw(0x14000312000, {0x0, 0x0})
        github.com/walles/moar/m/screenLines.go:37 +0x40
github.com/walles/moar/m.(*Pager).StartPaging(0x14000312000, {0x101366ab8, 0x1400023c000}, 0x14000492400, 0x140003f3240)
        github.com/walles/moar/m/pager.go:351 +0x2cc

@walles
Copy link
Owner

walles commented Jan 7, 2025

More questions:

  1. Which version of ITerm2 are you using?
  2. If you try another terminal (not ITerm2), do you still get this crash?
  3. Does less work if you invoke it the same way (through ug)?
  4. Do you know when this started happening? Months ago? Days ago? Did you change anything at that time?

I need to look into what these numbers mean exactly, but the terminal state is very different on your system compared to mine. Based on the termios man page and termios.h.

Yours (broken):

terminal state:
&{state:{termios:{Iflag:10240 Oflag:2 Cflag:19200 Lflag:67 Cc:[4 255 255 127 23 21 18 255 3 28 26 25 17 19 22 15 1 0 20 255] Ispeed:9600 Ospeed:9600}}}

Mine (works):

terminal state:
&{state:{termios:{Iflag:24580 Oflag:6 Cflag:19200 Lflag:536870983 Cc:[4 255 255 127 23 21 18 0 3 28 26 25 17 19 22 15 1 0 20 0] Ispeed:38400 Ospeed:38400}}}

@ciscohack
Copy link
Author

ciscohack commented Jan 7, 2025

@walles Now i am using ghostty terminal version 1.0.1

Which version of ITerm2 are you using? ---> ghostty terminal version 1.0.1
If you try another terminal (not ITerm2), do you still get this crash? earlier tried other terminal
Does less work if you invoke it the same way (through ug)? yes less working fine with no crash
Do you know when this started happening? Months ago? Days ago? Did you change anything at that time?
that i am not very sure

one question why in trace or any freeze case ctrl + c or z or ESC not letting moar to exit from prompt...i think we should have way to force exit moar in any case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants