lharding / tasknc

ncurses wrapper around taskwarrior
MIT License
117 stars 18 forks source link

Segfaults running on Linux 64-bit #14

Closed irl closed 12 years ago

irl commented 12 years ago

Segfaults when trying to run it.

[2012-11-08 14:24:37] ERROR: source: file "/meta/i/irl/.config/tasknc/config" could not be opened [2012-11-08 14:24:37] ERROR: SEGFAULT [2012-11-08 14:24:37] ERROR: segmentation fault, exiting

Valgrind error can be found at: https://gist.github.com/4039110

mjheagle8 commented 12 years ago

Hi, Thanks for trying tasknc! It seems that this is caused by the file in the first line of the error message not existing. Try creating an empty file at that location and see if that fixes your problem. Thanks, mjheagle

irl commented 12 years ago

I created the file, and now that error disappears from the log, but the segmentation fault still occurs:

[2012-11-09 09:47:01] ERROR: SEGFAULT [2012-11-09 09:47:01] ERROR: segmentation fault, exiting

irl commented 12 years ago

Possibly useful debug information after a gdb run:

tasknc v0.8 configuring...Detaching after fork from child process 18886.

Program received signal SIGSEGV, Segmentation fault. wipe_screen (win=0x0, startl=0, stopl=0) at tasknc.c:795 795 wattrset(win, COLOR_PAIR(0)); Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6_3.6.x86_64 ncurses-libs-5.7-3.20090208.el6.x86_64

mjheagle8 commented 12 years ago

Okay, it appears that one of the ncurses windows is being set to null. I just pushed a commit that should help find the source of this error. Please run tasknc with the -l8 flag, and email me a copy of the log file. (This will contain information about the tasks you have pending);

Thanks, mjheagle

irl commented 12 years ago

https://gist.github.com/4045961

Doesn't seem to contain any information about tasks I have pending though....

mjheagle8 commented 12 years ago

It appears the segfault is occurring earlier than I thought in the code. Can you run tasknc in gdb, then run backtrace once it segfaults and post the output so I can see the stack at the time of the crash? Thanks, Mjheagle

irl commented 12 years ago

tasknc v0.8 configuring...Detaching after fork from child process 7039.

Program received signal SIGSEGV, Segmentation fault. wipe_screen (win=0x0, startl=0, stopl=0) at tasknc.c:796 796 wattrset(win, COLOR_PAIR(0)); Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.80.el6_3.6.x86_64 ncurses-libs-5.7-3.20090208.el6.x86_64 (gdb) backtrace

0 wipe_screen (win=0x0, startl=0, stopl=0) at tasknc.c:796

1 0x0000000000405c1c in statusbar_message (dtmout=3, format=) at statusbar.c:369

2 0x00000000004086e5 in configure () at tasknc.c:270

3 0x0000000000408c46 in main (argc=1, argv=0x7fffffffe208) at tasknc.c:887

(gdb)

irl commented 12 years ago

Please enjoy this absolutely horrific workaround:

https://gist.github.com/4051291

It seems that wipe_screen is being called for the statusbar before the statusbar is being created. This workaround creates the window, so that the wipe can happen, and then the window is replaced later when it is created properly. This does allow the program to run, but is clearly not the solution.

EDIT: Thinking about it, a slightly better workaround would be to just return if the window is null.

irl commented 12 years ago

Pull request submitted with a proper fix.

mjheagle8 commented 12 years ago

Thank you very much for the patch! I will add you to the (newly created) contributors list. :)

If you dont mind, I may change it a little bit, but I have just merged it.

Thanks for using tasknc, and thank you for your patch!