[ubuntu-mono] [Bug 475811] Re: F-spot crashes when i start It.

knarf launchpad-ubuntu-f at unternet.org
Thu Nov 26 00:28:47 GMT 2009


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.
                        // Note: different checks in 1.x and 2.0
                        if (!CheckSchemeName (scheme))
                                return Locale.GetText ("URI scheme must start with a letter and must consist of one of alphabet, digits, '+', '-' or '.' character.");

-- 
F-spot crashes when i start It.
https://bugs.launchpad.net/bugs/475811
You received this bug notification because you are a member of MOTU Mono
Team, which is subscribed to f-spot in ubuntu.



More information about the Ubuntu-mono mailing list