hledger icon indicating copy to clipboard operation
hledger copied to clipboard

hledger-ui can crash from keyboard input at startup

Open ply opened this issue 7 years ago • 6 comments

Steps to reproduce (I'm using version 1.9):

$ hledger ui -f file
<press any key before interface loads (you have to be fast or just very impatient)>
<get error which closes the program, usually segfault>

ply avatar Apr 26 '18 16:04 ply

Wow.. thanks for the report. I can reproduce by hledger-ui <ENTER><ENTER><ENTER><ENTER>.

simonmichael avatar Apr 26 '18 17:04 simonmichael

I'm not able to reproduce this in master. Is this still relevant or can it be closed?

Xitian9 avatar Apr 03 '21 05:04 Xitian9

I can still reproduce this with hledger-1.21, though it's not that easy. I load the 1000 transaction sample journal and hammer on the enter key as fast as I can. I see it die every N attempts, where N is somewhere between 10 and 100. On mac it looks like:

$ hledger-ui -f examples/1000x1000x10.journal<ENTER><ENTER><ENTER><ENTER><ENTER>...
...
 123:124:125:126:127:128:129:12a           -149.00 T, -772.31 Z
 123:124:125:126:127:128:129:12a:12b         150.00 T, 650.00 Z
 123:124:125:126:127:128:129:12a:12b:12c   -650.00 A, -150.00 T
────────────────────────────────────────────────────────────────── ?:help t:list/tree -+:depth H:end-bals/changes F:forecast a:add q:quit ──────────────────────────────────────────────────────────────────hledger-ui(40710,0x2016ace00) malloc: *** error for object 0x7fd964e040d0: pointer being freed was not allocated
hledger-ui(40710,0x2016ace00) malloc: *** set a breakpoint in malloc_error_break to debug
Abort trap: 6
$

On gnu/linux it looks like:

$ hledger-ui -f examples/1000x1000x10.journal<ENTER><ENTER><ENTER><ENTER><ENTER>...
Segmentation fault (core dumped)
$

simonmichael avatar Apr 03 '21 23:04 simonmichael

A much faster way to reproduce it:

$ while true; do hledger-ui -f examples/1000x1000x10.journal || break; sleep 0.1; done

and hammer on the q key until it breaks.

A good next step would be to try this with a minimal brick app.

simonmichael avatar Apr 03 '21 23:04 simonmichael

Another way to reproduce it on GNU/Linux and X11; in my case it breaks 100% of the times I tried:

$ xdotool type "asdf"; hledger-ui
asdfSegmentation fault (core dumped)

pedro-nonfree avatar Sep 01 '24 21:09 pedro-nonfree

I couldn't reproduce this today on mac. Would appreciate any confirmations that this is still reproducible with hledger-ui 1.43 (all platforms).

simonmichael avatar Jun 15 '25 23:06 simonmichael