No conversion & bad error message with SQLite 2.x database

Bug #64323 reported by Fabio Berta
22
Affects Status Importance Assigned to Milestone
F-Spot
Invalid
Critical
f-spot (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Binary package hint: f-spot

Ok, Andrew told me to open up a new bug, here it is :)
This is what I get when I start f-spot on my installed edgy system:

Starting new FSpot server
XXXXX
Mono.Data.SqliteClient.SqliteSyntaxException: file is encrypted or is not a database
  at Mono.Data.SqliteClient.SqliteCommand.GetNextStatement (IntPtr pzStart, System.IntPtr pzTail, System.IntPtr pStmt) [0x00000]
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteReader (CommandBehavior behavior, Boolean want_results, System.Int32 rows_affected) [0x00000]
  at Mono.Data.SqliteClient.SqliteCommand.ExecuteNonQuery () [0x00000]
  at MetaStore.CreateTable () [0x00000]
  at MetaStore..ctor (Mono.Data.SqliteClient.SqliteConnection connection, Boolean is_new) [0x00000]
  at Db.Init (System.String path, Boolean create_if_missing) [0x00000]
  at FSpot.Core..ctor () [0x00000]
  at FSpot.Driver.Main (System.String[] args) [0x00000]
XXXXX
Starting new FSpot server
Starting new FSpot server
Starting new FSpot server

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

Stacktrace:

  at (wrapper managed-to-native) System.Threading.Monitor.Monitor_try_enter (object,int) <0x00004>
  at (wrapper managed-to-native) System.Threading.Monitor.Monitor_try_enter (object,int) <0xffffffff>
  at System.Threading.Monitor.Enter (object) <0x00013>
  at (wrapper synchronized) DBus.Service.remove_SignalCalled (DBus.Service/SignalCalledHandler) <0xffffffff>
  at FSpot.Core.Proxy.Finalize () <0x00015>
  at (wrapper runtime-invoke) System.Object.runtime_invoke_void (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

        mono(mono_handle_native_sigsegv+0xde) [0x81566de]
        mono [0x8122f18]
        [0xffffe440]
        mono [0x80c3af3]
        [0xb73a9bc1]
        [0xb73a9b4c]
        [0xb4f51d8c]
        [0xb4f51d5e]
        [0xb4f51cd9]
        mono [0x80af143]
        mono [0x8115b81]
        mono [0x80af277]
        mono [0x80c6484]
        mono [0x8109ade]
        mono [0x811fe85]
        /lib/tls/i686/cmov/libpthread.so.0 [0xb7ea3504]
        /lib/tls/i686/cmov/libc.so.6(__clone+0x5e) [0xb7e104de]
Aborted (core dumped)

Hopefully this information is useful!

Revision history for this message
Andrew Mitchell (ajmitch) wrote :

Thanks, do you have /home on NFS, or did you run f-spot back in breezy/early dapper when the default database version was sqlite 2?

Changed in f-spot:
status: Unconfirmed → Needs Info
Revision history for this message
Fabio Berta (fberta) wrote :

Nope, no NFS! Hmm, I think I started using f-spot in late dapper development cycle. So the answer would be no too!

Revision history for this message
Andrew Mitchell (ajmitch) wrote :

Could you please paste the output of:
  file ~/.gnome2/f-spot/photos.db
and that of
  head -c 64 ~/.gnome2/f-spot/photos.db

Revision history for this message
Fabio Berta (fberta) wrote :

You were right! It's a sqlite2 database! If I remove the f-spot folder, so that it creates a new one, then f-spot works! But with the old database, it doesn't!

Output:
w00t@ubuntu:~$ file ~/.gnome2/f-spot/photos.db
/home/w00t/.gnome2/f-spot/photos.db: SQLite Database Version
w00t@ubuntu:~$ head -c 64 ~/.gnome2/f-spot/photos.db
** This file contains an SQLite 2.1 database **(u���

Revision history for this message
Andrew Mitchell (ajmitch) wrote :

Thanks - it's hard to have a conversion script to handle upgrades like this, as it'd require having sqlite & libsqlite0 installed. You can probably install libsqlite0 to access the old database, and if you install the sqlite & sqlite3 packages, you can convert your database to the new format by:

sqlite ~/.gnome2/f-spot/photos.db .dump | sqlite3 ~/.gnome2/f-spot/photos.db.3
mv ~/.gnome2/f-spot/photos.db ~/.gnome2/f-spot/photos.db.2
mv ~/.gnome2/f-spot/photos.db.3 ~/.gnome2/f-spot/photos.db

I think I'll try & include this as a script in /usr/lib/f-spot for the next upload, and try & change the error message a bit.

Revision history for this message
Andrew Mitchell (ajmitch) wrote :

Setting priority to low as it should only affect upgrades from the universe package.

Changed in f-spot:
importance: Undecided → Low
status: Needs Info → Confirmed
Revision history for this message
Nick B. (futurepilot) wrote :

I have the same problem on a fresh install of Feisty. I've attached the output from the terminal

Revision history for this message
Robin Munn (rmunn) wrote :

One upstream developer has said,"this is a packaging issue. If gentoo or ubuntu bundled f-spot with sqlite2 in the past, they shouldn't had removed that dependency without providing an upgrade script or mechanism."

Another person followed up on upstream Bugzilla with the opinion that upstream should handle this scenario.

So upstream may or may not fix this, but my guess is that they'll stick with the "distros should handle this" opinion. Therefore, a conversion script should be included in the Ubuntu package, for the benefit of those who did an upgrade from an older version of f-spot (say, one that came with Breezy, or even Hoary) to a recent version.

Changed in f-spot:
status: Unknown → Rejected
Revision history for this message
Mikael Frykholm (mikael) wrote :

I think I got bitten by this as well.
I had to run f-spot-sqlite-upgrade to stop f-spot complaining about index is 0 something something -1.
f-spot would freeze when trying to tag an image and would complain when trying to import photos.
The photos got copied to the Photos folder but did not get added to the catalog.

Revision history for this message
Rylie Pavlik (abiryan) wrote :

I had the same problem going from Feisty to Gutsy. Andrew Mitchell's instructions worked for me, and should be included as automatic if at all possible.

Revision history for this message
Maia Everett (linneris) wrote :

Should be fixed in 0.4.1-4ubuntu2 with the automatic sqlite transition (thanks to meebey). Can you please verify if the issue persists?

Changed in f-spot:
assignee: nobody → sikon
status: Confirmed → Incomplete
Maia Everett (linneris)
Changed in f-spot:
assignee: sikon → nobody
status: Incomplete → Fix Released
Revision history for this message
cbcalvin (cbc0777) wrote :

Database is corrupt after migration from Ubuntu 7.4 to 7.8 to 8.4. Possible solution is export databse content to sql file. Delete database. Allow f-spot to recreate it. Edit the exported sql file to remove the creation of the system tables. Apply the remaining sql to import the content back into the database. This could be done with a script by a clever person.

Changed in f-spot:
importance: Unknown → Critical
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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