Monday, July 27, 2009

fix f-spot downgrade version crash database

Have you ever downgraded F-Spot from Debian Unstable to Stable, only to find that the moment you create a "version" of a photo, your entire F-Spot gallery becomes hosed?

The solution is to fix your database to not include the new fields that came with whatever that new version of F-spot was, and make it like it was back in F-Spot 0.4.4. F-Spot might even be nice and move your "broken" database to the root of your home folder. Never fear! Open up the file "photos.db" (which may be at ~/.gnome2/f-spot/) in your favorite SQL Lite editor (apt-get install sqlitebrowser). Now, modify the photos and the photos_versions table to remove the md5sum field. That's it!

They must have added md5sum because it was a good idea, but didn't consider all of us that might downgrade to a version that didn't know about this field!

Here are the errors you may see:

Starting new FSpot server

Unhandled Exception: Mono.Data.SqliteClient.SqliteExecutionException: SQL logic error or missing database
at Mono.Data.SqliteClient.SqliteCommand.ExecuteStatement (IntPtr pStmt, System.Int32& cols, System.IntPtr& pazValue, System.IntPtr& pazColName) [0x00000]
at Mono.Data.SqliteClient.SqliteCommand.ExecuteStatement (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 Banshee.Database.QueuedSqliteCommand.Execute () [0x00000]




Starting new FSpot server
Exception in Gtk# callback delegate
Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
System.NullReferenceException: Object reference not set to an instance of an object
at FSpot.Utils.UriUtils.UriToStringEscaped (System.Uri uri) [0x00000]
at FSpot.ThumbnailGenerator.ThumbnailPath (System.Uri uri) [0x00000]
at FSpot.Widgets.IconView.DrawCell (Int32 thumbnail_num, Rectangle area) [0x00000]
at FSpot.Widgets.IconView.DrawAllCells (Rectangle area) [0x00000]
at FSpot.Widgets.IconView.OnExposeEvent (Gdk.EventExpose args) [0x00000]
at Gtk.Widget.exposeevent_cb (IntPtr widget, IntPtr evnt) [0x00000]
at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal)
at Gtk.Widget.exposeevent_cb(IntPtr widget, IntPtr evnt)
at Gtk.Widget.exposeevent_cb(IntPtr , IntPtr )
at Gtk.Adjustment.gtk_adjustment_value_changed(IntPtr )
at Gtk.Adjustment.gtk_adjustment_value_changed(IntPtr )
at Gtk.Adjustment.ChangeValue()
at FSpot.Widgets.IconView.ScrollTo(Int32 cell_num, Boolean center)
at FSpot.Widgets.IconView.ScrollTo(Int32 cell_num)
at MainWindow.JumpTo(Int32 index)
at MainWindow.LoadPreference(System.String key)
at MainWindow.HandleIconViewReady(System.Object sender, System.EventArgs args)
at Gtk.Widget.SizeAllocatedSignalCallback(IntPtr arg0, IntPtr arg1, IntPtr gch)
at Gtk.Widget.SizeAllocatedSignalCallback(IntPtr , IntPtr , IntPtr )
at Gtk.Application.gtk_main()
at Gtk.Application.gtk_main()
at Gtk.Application.Run()
at Gnome.Program.Run()
at FSpot.Driver.Main(System.String[] args)