crashes when a filename uses ":"

Bug #475811 reported by dlaszlo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
F-Spot
Fix Released
Medium
f-spot (Ubuntu)
Fix Released
Medium
Ubuntu Desktop Bugs

Bug Description

Binary package hint: f-spot

F-spot doesn't work since I have upgraded Ubuntu to version 9.10.
I get the following error message, when I start It: URI scheme must start with a letter and must consist of one of alphabet, digits, '+', '-' or '.' character. (in `System')

I have been using f-spot since it's the main photo gallery in ubuntu, and I have lot of pictures.

I found similar bug in this site, but for version 8.10 and with low importance.

Could you suggest me anything for the souliton of this problem, or help you except of this log?

Thank you for your help in advance.

Log:

** Running f-spot in Debug Mode **
** Running Mono with --debug **
Xlib: extension "RANDR" missing on display ":0.0".
Gtk-Message: Failed to load module "globalmenu-gnome": libglobalmenu-gnome.so: nem nyitható meg a megosztott objektumfájl: Nincs ilyen fájl vagy könyvtár
[Info 21:20:07.456] Initializing DBus
[Debug 21:20:07.649] DBusInitialization took 0,177432s
[Info 21:20:07.649] Initializing Mono.Addins
[Debug 21:20:07.888] Mono.Addins Initialization took 0,238372s
[Info 21:20:07.895] Starting new FSpot server (f-spot 0.6.1.4)
[Debug 21:20:08.088] Db Initialization took 0,146042s

** (f-spot:5417): CRITICAL **: atk_object_set_name: assertion `name != NULL' failed

** (f-spot:5417): CRITICAL **: atk_object_set_name: assertion `name != NULL' failed

** (f-spot:5417): CRITICAL **: atk_object_set_name: assertion `name != NULL' failed

** (f-spot:5417): CRITICAL **: atk_object_set_name: assertion `name != NULL' failed

** (f-spot:5417): CRITICAL **: atk_object_set_name: assertion `name != NULL' failed
[Debug 21:20:08.580] Query Started : SELECT * FROM photos ORDER BY time DESC, filename DESC
[Debug 21:20:08.640] QueryToTemp took 0,059585s : SELECT * FROM photos ORDER BY time DESC, filename DESC
[Debug 21:20:08.640] Reloading the query took 0,062687s
[Debug 21:20:08.941] PhotosPerMonth took 0,048361s
[Debug 21:20:08.943] TimeAdaptor REAL Reload took 0,25309s
[Warn 21:20:09.025] Caught an exception - URI scheme must start with a letter and must consist of one of alphabet, digits, '+', '-' or '.' character. (in `System')
  at System.Uri.Parse (UriKind kind, System.String uriString) [0x00000]
  at System.Uri.ParseUri (UriKind kind) [0x00000]
  at System.Uri..ctor (System.Uri baseUri, System.String relativeUri, Boolean dontEscape) [0x00000]
  at System.Uri..ctor (System.Uri baseUri, System.String relativeUri) [0x00000]
  at PhotoStore.GetAllVersions () [0x00000]
  at PhotoStore.Query (Banshee.Database.DbCommand query) [0x00000]
  at PhotoStore.Query (System.String query) [0x00000]
  at PhotoStore.QueryFromTemp (System.String temp_table, Int32 offset, Int32 limit) [0x00000]
  at FSpot.PhotoQuery+PhotoCache.Get (Int32 index) [0x00000]
  at FSpot.PhotoQuery.get_Item (Int32 index) [0x00000]
  at FSpot.BrowsablePointer.get_Current () [0x00000]
  at FSpot.BrowsablePointer.SetIndex (Int32 value, IBrowsableItemChanges changes) [0x00000]
  at FSpot.BrowsablePointer.SetIndex (Int32 value) [0x00000]
  at FSpot.BrowsablePointer.set_Index (Int32 value) [0x00000]
  at FSpot.BrowsablePointer..ctor (IBrowsableCollection collection, Int32 index) [0x00000]
  at FSpot.PhotoView..ctor (IBrowsableCollection query) [0x00000]
  at MainWindow..ctor (.Db db) [0x00000]
  at FSpot.Core.get_MainWindow () [0x00000]
  at FSpot.Core.Organize () [0x00000]
  at FSpot.Driver.Main (System.String[] args) [0x00000]

Revision history for this message
dlaszlo (laszlo-david) wrote :
Revision history for this message
dlaszlo (laszlo-david) wrote :

I put System.Console.WriteLine to PhotoStore.GetAllVersions method to check parameters of Uri constructor, and I get this:

.
.
base_uri = file:///home/zita/Képek/2009/07/31/
filename = DSCF8355%20(M%C3%B3dos%C3%ADtva%20ekkor:%20gThumb%20k%C3%A9pmegjelen%C3%ADt%C5%91).JPG
[Warn 21:55:14.014] Caught an exception - URI scheme must start with a letter and must consist of one of alphabet, digits, '+', '-' or '.' character. (in `System')
.
.

Revision history for this message
knarf (launchpad-ubuntu-f) wrote :

I notice there is a colon in that filename. Unix has no problems with that but Windows does. Maybe mono does as well? That would be a bug by the way...

Revision history for this message
knarf (launchpad-ubuntu-f) wrote :
Download full text (3.4 KiB)

It does seem to be the colon in the filename which causes the crash. I ran a photos.db through an instrumentd f-spot with the following result:

...
...
AppendValues ( Gtk.TreeIter, 2003%20Kitchen%20Before)
AppendValues ( Gtk.TreeIter, Michigan)
AppendValues ( Gtk.TreeIter, Volume%202)
AppendValues ( Gtk.TreeIter, Volume%203)
AppendValues ( Gtk.TreeIter, 2005-02-12--14:13:46)
[Warn 00:53:34.914] Caught an exception - URI scheme must start with a letter and must consist of one of alphabet, digits, '+', '-' or '.' character. (in `System')

Notice that as soon as a name with a colon in it shows up f-spot børks. A look at mcs/class/System/System/Uri.cs (part of Mono) shows what happens: as soon as there is a colon in a string and that colon is not at position 0 (which is always an error) or position 1 (which is interpreted as following an MS-DOS/Windows drive letter) the part of the string before the colon is interpreted as an URI scheme (eg http, file, ftp, etc.). This will naturally lead to an error as (in the above example) ' 2005-02-12--14' is not a valid scheme.

The solution is for f-spot to %-encode colons in the string before it gets handled by any of Mono's URI-handling functions. It does this for spaces (->%20) but not for colons (->%3A). This should be changed...

This are the salient bits from Uri.cs:

pos = uriString.IndexOf (':');
                        if (pos == 0) {
                                return "Invalid URI: The format of the URI could not be determined.";
                        } else if (pos < 0) {
                                // It must be Unix file path or Windows UNC
                                if (uriString [0] == '/' && Path.DirectorySeparatorChar == '/'){
                                        ParseAsUnixAbsoluteFilePath (uriString);
                                        if (kind == UriKind.Relative)
                                                isAbsoluteUri = false;

                                } else if (uriString.Length >= 2 && uriString [0] == '\\' && uriString [1] == '\\')
                                        ParseAsWindowsUNC (uriString);
                                else {
                                        /* Relative path */
                                        isAbsoluteUri = false;
                                        path = uriString;
                                }
                                return null;
                        } else if (pos == 1) {
                                if (!IsAlpha (uriString [0]))
                                        return "URI scheme must start with a letter.";
                                // This means 'a:' == windows full path.
                                string msg = ParseAsWindowsAbsoluteFilePath (uriString);
                                if (msg != null)
                                        return msg;
                                return null;
                        }

                        // scheme
                        scheme = uriString.Substring (0, pos).ToLower (CultureInfo.InvariantCulture);

                        // Check scheme name characters as specified in RFC2396.
           ...

Read more...

summary: - F-spot crashes when i start It.
+ F-spot crashes when a filename uses ":"
summary: - F-spot crashes when a filename uses ":"
+ crashes when a filename uses ":"
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for your bug report. This bug has been reported to the developers of the software. You can track it and make comments here: https://bugzilla.gnome.org/show_bug.cgi?id=603028

Changed in f-spot (Ubuntu):
assignee: nobody → Ubuntu Desktop Bugs (desktop-bugs)
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Sebastien Bacher (seb128) wrote :

Could somebody having the bug add .config/f-spot/photos.db there or explain how to import a buggy image?

Revision history for this message
knarf (launchpad-ubuntu-f) wrote :

Sebastien: the easiest way to import a 'buggy' image (?) is to remove the colon from the name... or is that not what you meant?

To get f-spot to run as it is (without any patches) I'd suggest changing the name of the picture on the filesystem and in the database. Even though you could %-encode colons in the database this currently does not seem to work well as they get written back as ordinary colons by f-spot.

To change the name in the database I'd suggest dumping it, editing the dump and importing it again:

sqlite3 .config/f-spot/photos.db .dump > photos.dump

edit the resulting dump (change the offending colons into periods or underscores or whatnot)
change the filenames on the filesystem in a similar way

import the database:

cat photos.dump|sqlite3 photos.db

If sqlite3 does not give any errors and the database has a sane size (slightly smaller than the original photos.db) you can try to start f-spot with it:

mv .config/f-spot/photos.db .config/f-spot/photos.db.org
mv photos.db config/f-spot/photos.db
f-spot --debug

If it starts and the offending pictures are visible you're good to go. If it crashes you might have forgotten a colon or two or messed up the database in another way. If the offending pictures are missing you might have forgotten to rename them in the filesystem.

Revision history for this message
Sebastien Bacher (seb128) wrote :

the question is to know how you managed to get f-spot crashing due such files since it refuses to import files using a ':'

Revision history for this message
Jean Levasseur (levasseur.jean) wrote :

Well, I can confirm this issue. I'm using f-spot for years (with some files containing colons in their name) and recently (after update) only that made the application crash. I can provide you with a little python script I wrote to rename files and database entries, but that would not solve the real problem, though...

I can confirm that after renaming, f-spot works like a charm again!

Revision history for this message
knarf (launchpad-ubuntu-f) wrote :

There is a notice in Mono's Uri.cs that there is a difference between Mono 1.2 and Mono 2.0 in how scheme name characters are checked:

                        // Check scheme name characters as specified in RFC2396.
                        // Note: different checks in 1.x and 2.0

(mcs/class/System/System/Uri.cs:1380)

Maybe that is what triggered this bug?

Revision history for this message
Martin Mai (mrkanister-deactivatedaccount-deactivatedaccount) wrote :

Upstream bug has been marked as duplicate of bug https://bugzilla.gnome.org/show_bug.cgi?id=559093.

Changed in f-spot:
status: Unknown → Incomplete
Revision history for this message
Martin Mai (mrkanister-deactivatedaccount-deactivatedaccount) wrote :

This is fixed in Ubuntu 10.10 now. Thanks for reporting.

Changed in f-spot (Ubuntu):
status: Triaged → Fix Released
Changed in f-spot:
status: Incomplete → Fix Released
Changed in f-spot:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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