Homebank segfaults on file open on x64

Bug #1103668 reported by Sander Lepik
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
HomeBank
Fix Released
High
Maxime DOYEN

Bug Description

$ gdb homebank
GNU gdb (GDB) 7.5.1-4.mga3 (Mageia release 3)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-mageia-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/bin/homebank...Reading symbols from /usr/lib/debug/usr/bin/homebank.debug...done.
done.
(gdb) run
Starting program: /usr/bin/homebank
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Detaching after fork from child process 15392.
Detaching after fork from child process 15393.

Program received signal SIGSEGV, Segmentation fault.
ui_mainwindow_open_internal (widget=widget@entry=0x7881b0 [GtkWindow], user_data=user_data@entry=0x0) at dsp_mainwindow.c:1424
1424 ui_mainwindow_recent_add(data, GLOBALS->xhb_filepath);
(gdb) thread apply all bt full

Thread 1 (Thread 0x7ffff7fc38c0 (LWP 15388)):
#0 ui_mainwindow_open_internal (widget=widget@entry=0x7881b0 [GtkWindow], user_data=user_data@entry=0x0) at dsp_mainwindow.c:1424
        data = <optimized out>
        r = 1
#1 0x0000000000415110 in main (argc=1, argv=0x7fffffffe148) at homebank.c:1283
        wg = <optimized out>
        option_context = 0x0
        option_group = <optimized out>
        error = 0x0
        mainwin = 0x7881b0 [GtkWindow]
        splash = <optimized out>
        openlast = 1

Version: 4.5
OS: Mageia

Revision history for this message
psyca (psyca) wrote :

Seems to be maybe the same bug like https://bugs.launchpad.net/homebank/+bug/1046106
or?

Revision history for this message
Maxime DOYEN (mdoyen) wrote :

ui_mainwindow_recent_add seems to be the cause.

Changed in homebank:
assignee: nobody → Maxime Doyen (mdoyen)
importance: Undecided → High
milestone: none → 4.5.1
status: New → In Progress
Revision history for this message
Maxime DOYEN (mdoyen) wrote :

Are you able to compile from source with console debug:
find ./src -name '*.c' | xargs perl -pi -w -e 's/MYDEBUG 0/MYDEBUG 1/g'

then post the last few lines into the console
and maybe gdb debug with debug symbols

Revision history for this message
Sander Lepik (sander85) wrote :

Not sure if it will help:

da_tag_get_by_name
 -> storing 85=>ema at tags pos 0
 att=kxfer val=163

[hbfile] sanity_check
da_acc_get_account
da_cat_get
da_pay_get_payee
[~10300 repeating lines removed]
da_acc_get_account
da_cat_get
da_pay_get_payee
 -> file loaded ok : rcode=1

[hbfile] insert_scheduled_transactions
(archive_add_get_nbdays)- set to 1 of next month(transaction) transaction add
da_acc_get_account
da_transaction_clone
da_transaction_splits_clone
 clone 0x7fffffffd900 -> 0x7e7890, 0 splits
da_acc_get_account
 + add normal 0x7e7890
da_acc_get_account
(transaction) transaction add
da_acc_get_account
da_transaction_clone
da_transaction_splits_clone
 clone 0x7fffffffd900 -> 0xbcca00, 0 splits
da_acc_get_account
 + add normal 0xbcca00
da_acc_get_account
(transaction) transaction add
da_acc_get_account
da_transaction_clone
da_transaction_splits_clone
 clone 0x7fffffffd900 -> 0xa317a0, 0 splits
da_acc_get_account
 + add normal 0xa317a0
da_acc_get_account
(transaction) transaction add
da_acc_get_account
da_transaction_clone
da_transaction_splits_clone
 clone 0x7fffffffd900 -> 0xa2e600, 0 splits
da_acc_get_account
 + add normal 0xa2e600
da_acc_get_account
(transaction) transaction add
da_acc_get_account
da_transaction_clone
da_transaction_splits_clone
 clone 0x7fffffffd900 -> 0xa41e00, 0 splits
da_acc_get_account
 + add normal 0xa41e00
da_acc_get_account
(transaction) transaction add
da_acc_get_account
da_transaction_clone
da_transaction_splits_clone
 clone 0x7fffffffd900 -> 0xa41ef0, 0 splits
da_acc_get_account
 + add normal 0xa41ef0
da_acc_get_account
(transaction) transaction add
da_acc_get_account
da_transaction_clone
da_transaction_splits_clone
 clone 0x7fffffffd900 -> 0xa41fc0, 0 splits
da_acc_get_account
 + add normal 0xa41fc0
da_acc_get_account
(transaction) transaction add
da_acc_get_account
da_transaction_clone
da_transaction_splits_clone
 clone 0x7fffffffd900 -> 0xa42090, 0 splits
da_acc_get_account
 + add normal 0xa42090
da_acc_get_account
(transaction) transaction add
da_acc_get_account
da_transaction_clone
da_transaction_splits_clone
 clone 0x7fffffffd900 -> 0xa42160, 0 splits
da_acc_get_account
 + add normal 0xa42160
da_acc_get_account

[homebank] lastopenedfiles save

account_compute_balances start
da_acc_get_account
[~3400 repeating lines removed]
da_acc_get_account

account_compute_balances end

Program received signal SIGSEGV, Segmentation fault.
ui_mainwindow_open_internal (widget=widget@entry=0x89c1f0, user_data=user_data@entry=0x0) at dsp_mainwindow.c:1424
1424 ui_mainwindow_recent_add(data, GLOBALS->xhb_filepath);

Revision history for this message
Maxime DOYEN (mdoyen) wrote :

Yes it helps, has it seem the ui_mainwindow_recent_add() fucntion is not reach at all before the crash, which is not normal, at last this function should output the first printf: ui_mainwindow_recent_add

can you do 2 more things:

1) comment the line ui_mainwindow_recent_add(data, GLOBALS->xhb_filepath);
and compile/run again, this is to confirm the problem is in this fucntion, and if not call issue has gone

post here the last few lines of the console, after 'account_compute_balances end'

Revision history for this message
Sander Lepik (sander85) wrote :

account_compute_balances end

Program received signal SIGSEGV, Segmentation fault.
ui_mainwindow_open_internal (widget=widget@entry=0x83c1f0, user_data=user_data@entry=0x0) at dsp_mainwindow.c:1425
1425 ui_mainwindow_populate_accounts(GLOBALS->mainwindow, NULL);

Revision history for this message
Sander Lepik (sander85) wrote :

One interesting thing I noticed that might give some clues. The 32-bit build seems to work, even on 64-bit system. But the 64-bit build fails. So the problem seems to be arch dependent.

Revision history for this message
Maxime DOYEN (mdoyen) wrote :

Wow... It seems any function call crash after account_compute_balances();
Can you add a simple printf after this call to see if it print ?

account_compute_balances();

gprint("crash or not crash ?\n");

Revision history for this message
Sander Lepik (sander85) wrote :

Compiling fails:

dsp_mainwindow.o: In function `ui_mainwindow_open_internal':
/home/sander/rpmbuild/BUILD/homebank-4.5/src/dsp_mainwindow.c:1424: undefined reference to `gprint'
collect2: error: ld returned 1 exit status

Revision history for this message
Sander Lepik (sander85) wrote :

I replaced the gprint with g_print, this is the outcome:

$ homebank
crash or not crash ?
Segmentation fault

Maxime DOYEN (mdoyen)
summary: - Hombank segfaults when opening .xhb file or when Homebank is trying to
- open last opened file
+ Homebank segfaults on file open on x64
Revision history for this message
Maxime DOYEN (mdoyen) wrote :

Just tested aftero compiled under Ubuntu 13.04 x64, and got no problem at all. Only a few warning during compilation.
I have a core i3, so it's pure 64bit system.
Have you had some warning during compile time, what was they ?

If any x64 linux distro system can test and give some more clue, as I must admit for the moment not knowing what's going on there. Still continue the analysis.

Revision history for this message
Maxime DOYEN (mdoyen) wrote :

Do you have a core generated ?
Can you gdb with the core: http://stackoverflow.com/questions/8305866/how-to-analyze-a-programs-core-dump-file

Revision history for this message
Sander Lepik (sander85) wrote :

Ok, I think we are closer to the fix, maybe. This is probably the warning that is causing trouble:

gcc -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/directfb -I/usr/include/libdrm -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -DSHARE_DIR=\""/usr/share/homebank"\" -DDATA_DIR=\""/usr/share"\" -O2 -g -pipe -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fPIC -Wall -Wmissing-prototypes -DOFX_ENABLE -MT homebank.o -MD -MP -MF .deps/homebank.Tpo -c -o homebank.o homebank.c
homebank.c: In function 'homebank_lastopenedfiles_save':
homebank.c:479:4: warning: passing argument 2 of 'g_key_file_to_data' from incompatible pointer type [enabled by default]
In file included from /usr/include/glib-2.0/glib.h:57:0,
                 from homebank.h:34,
                 from homebank.c:20:
/usr/include/glib-2.0/glib/gkeyfile.h:94:11: note: expected 'gsize *' but argument is of type 'guint *'
homebank.c: In function 'main':
homebank.c:1091:2: warning: 'g_type_init' is deprecated (declared at /usr/include/glib-2.0/gobject/gtype.h:669) [-Wdeprecated-declarations]

When I remove ~/.config/homebank/lastopenedfiles then the application doesn't crash, as soon as I open even the example file it will crash.

But I got it working when I commented out this function in dsp_mainwindow.c: homebank_lastopenedfiles_save();

So something is wrong in that function and probably the warning has something to do with it. Can you please try to fix that warning so I could try with a function that doesn't throw warning?

Do you still need the core?

Revision history for this message
Sander Lepik (sander85) wrote :
Revision history for this message
Maxime DOYEN (mdoyen) wrote :

Ohhh. Nasty silent warning under 32bit platform.
Anyway if it is fixed, thanks for reporting and for assistance to fix it.
I will fix few more warning using -Wextra flag.

Maxime DOYEN (mdoyen)
Changed in homebank:
status: In Progress → Fix Committed
Maxime DOYEN (mdoyen)
Changed in homebank:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.