walles / moar

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

Crashes on startup #171

Closed postsolar closed 6 months ago

postsolar commented 6 months ago
> moar <(echo 123) 

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

Version: v1.19.0-8-g21afb4f
LANG   : en_US.UTF-8
TERM   : foot-extra

GOOS    : linux
GOARCH  : amd64
Compiler: gc
NumCPU  : 4

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference [recovered]
    panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5571504b2b45]

goroutine 1 [running]:
main.main.func1()
    github.com/walles/moar/moar.go:364 +0x155
panic({0x5571507c6420?, 0x55715090d130?})
    runtime/panic.go:914 +0x21f
main.startPaging.func1()
    github.com/walles/moar/moar.go:583 +0xb0
panic({0x5571507c6420?, 0x55715090d130?})
    runtime/panic.go:914 +0x21f
github.com/walles/moar/m.setStyle(0x0, {0x5571504d1422?, 0x1b63?}, 0x0)
    github.com/walles/moar/m/ansiTokenizer.go:92 +0x125
github.com/walles/moar/m.ConsumeLessTermcapEnvs(0x160?, 0x1?)
    github.com/walles/moar/m/ansiTokenizer.go:126 +0x8e
github.com/walles/moar/m.(*Pager).StartPaging(0xc000434000, {0x5571507f3c20?, 0xc000530fc0}, 0xc0000d0090?, 0x16?)
    github.com/walles/moar/m/pager.go:480 +0x15d
main.startPaging(0xc0000cc070?, {0x5571507f3c20?, 0xc000530fc0?}, 0x9?, 0xc000414210?)
    github.com/walles/moar/moar.go:594 +0x6f
main.main()
    github.com/walles/moar/moar.go:554 +0x116d

It stops crashing when I unset LESS_* variables. Here are the related environment settings:

Environment:
  Additional options are read from the MOAR environment variable.
  Current setting: MOAR="-colors=auto -no-linenumbers -no-statusbar -scroll-left-hint=ESC[2m← -scroll-right-hint=ESC[2m→ -statusbar=bold"
  LESS_TERMCAP_md (man page bold style): ESC[1;2;32m
  LESS_TERMCAP_us (man page underline style): ESC[04;33m
  LESS_TERMCAP_so (search hits and footer style): ESC[1;3;36m
walles commented 6 months ago

Thanks for the detailed report @postsolar!