Bug 346674

Summary: "SQLCache: DB Error: Cannot open database: unable to open database file Error opening database" and crash on launch
Product: [Applications] trojita Reporter: Dave Thompson <dwt>
Component: CoreAssignee: Trojita default assignee <trojita-bugs>
Status: RESOLVED WORKSFORME    
Severity: normal CC: jmunoz
Priority: NOR    
Version First Reported In: 0.5   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: GDB file as requested.
ldd /usr/bin/trojita output
WORKING config file
BROKEN config file

Description Dave Thompson 2015-04-25 21:39:29 UTC
I can't open Trojita.

Whenever I do, I get:

"SQLCache: DB Error: Cannot open database: unable to open database file Error opening database"

Reproducible: Always

Steps to Reproduce:
Installed Trojita
Ran in console


Actual Results:  
Crashed

Expected Results:  
Didn't crash!

Please let me know if you need any additional information.

I tried with the --log-to-disk flag but it's not obvious where the log file goes!
Comment 1 Thomas Lübking 2015-04-26 08:14:00 UTC
I don't think the DB Error will be the critical part (there's simply no cache to open; in doubt: "yet")

To investigate the crash, best run trojita in gdb
gdb --args trojita 2>&1 | tee trojita.gdb
> run
[wait for crash, gdb will be very noisy during loading symbols]
> bt
[hit enter until you reach the end of the backtrace]
> detach
> quit

Then attach the trojita.gdb
Comment 2 Jan Kundrát 2015-04-26 10:53:24 UTC
I just tried to check if I could reproduce this by simply `chmod -rx` of the Qt's plugins/sqldrivers/libsqlite.so, but on both Qt4 and Qt5, Trojita continues to work.

Dave, what "KUbuntu packages" do you use -- is it from https://build.opensuse.org/project/show/home:jkt-gentoo:trojita ?

Please get us the backtrace as Thomas described and reopen this bug.
Comment 3 Dave Thompson 2015-04-26 14:17:23 UTC
Created attachment 92231 [details]
GDB file as requested.
Comment 4 Dave Thompson 2015-04-26 14:23:28 UTC
The repository I used is:

http://download.opensuse.org/repositories/home:/jkt-gentoo:/trojita/xUbuntu_14.10/

Then I just did a "sudo apt-get install trojita"

One thing is probably important - this is KDE Plasma 5 I'm using: Frameworks Version 5.10.0
Comment 5 Thomas Lübking 2015-04-26 14:55:23 UTC
Trojita apparently links Qt4 though.

This might be it, because the backtrace is rather odd - a thread that starts by setting some QAction checked?

Do you have *.conf files in ~/.config/flaska.net/ ?
Please do NOT delete them, but you may want to move them away:

$ mv  ~/.config/flaska.net  ~/.config/flaska.bak
$ trojita

Please also attach the output of 
   ldd /usr/bin/trojita
to ensure it's not linked at Qt4 & Qt5.
Comment 6 Dave Thompson 2015-04-26 15:01:45 UTC
Created attachment 92232 [details]
ldd /usr/bin/trojita output
Comment 7 Dave Thompson 2015-04-26 15:04:02 UTC
That's got it working. Thank you very much for your help!
Comment 8 Jan Kundrát 2015-04-26 15:13:57 UTC
It's OK that trojita is linked against Qt4, the version we ship via OBS is Qt4-only for now.

Dave, could you please attach your original ~/.config/flaska.net/trojita.conf (now it's likely in ~/.config/flaska.bak/trojita.conf)? Feel free to remove the entire [General] section; in fact, pasting just what is found within the "[gui]" section is enough.

Please also include the size (resolution) of the screen which you were using at the time of the crash (some of the settings are resolution-dependant).

While the backtrace looks fishy, Trojita must cope with self-generated garbage in its config files without segfaults.
Comment 9 Dave Thompson 2015-04-26 15:27:34 UTC
Created attachment 92233 [details]
WORKING config file
Comment 10 Dave Thompson 2015-04-26 15:27:47 UTC
Created attachment 92234 [details]
BROKEN config file
Comment 11 Dave Thompson 2015-04-26 15:28:45 UTC
I'm running a dual screen config, with both monitors running at 1920x1080.
Comment 12 Jan Kundrát 2015-04-26 15:38:37 UTC
The bad thing is that I cannot reproduce this :(, neither on one screen nor with two separate screens (xrandr, not xinerama). I'm also running Plasma 5 (from git).

That could mean that my understanding of the root cause (trying to restore GUI elements which are not constructed yet) is wrong, of course. Given that the BT looks fishy, I don't think that we can fix the root cause, whatever it is. Thanks for reporting, though.

@Thomas, if you have some ideas, I'm all ears.
Comment 13 Dave Thompson 2015-04-26 15:46:02 UTC
I can replicate it - here's how (from a clean system with no trojita installed):

sudo bash
apt-get install trojita
run trojita
(press control-c at the initial settings dialog)
exit to normal user console
trojita - will always crash out when you cancel the dialogs.
Comment 14 Thomas Lübking 2015-04-26 16:53:29 UTC
Crossing users should have zero impact, but I cannot reproduce any segfault by quitting trojita while the config dialog is open (and starting it again)

Usually I would have said that the breaking cause is the unversioned state re/storage - at least if covered elements gets removed, the version needs to bump.

Unfortunately, QHeaderView doesn't support versioning, so one would eg. have to introduce an explicit header version key (and omit restore on mismatch)

That does however not match comment #13 at all %-\