GNOME Bugzilla – Bug 150218
get_short_name() assertion triggered by unknown method in URI
Last modified: 2004-12-22 21:47:04 UTC
* start some GNOME session with Nautilus and Panel * register mplayer as handler for rtsp URIs (via gnome-file-types-properties: description="Real Time Streaming Protocol"; program="mplayer '%s'") * place the attached file on the desktop * click the desktop file > gnome-panel enters some never ending crash orgie Sorry, don't have some usable backtrace, cause the break-my-gentoo guys[?] decided to strip all debug symbols -- Duh! Well, but appears like the crash happens in the recent files code. Erasing ~/.recently-used stops the crash orgie. Running panel from terminal reveals the following print-out before crashing: ** ERROR **: file egg-recent-item.c: line 303 (egg_recent_item_get_short_name): assertion failed: (uri != NULL) 302: uri = gnome_vfs_uri_new (item->uri); 303: g_assert (uri != NULL); /* We already checked this in egg_recent_item_set_uri() */ First of all I wonder about the comment, of course - as I doubt, that egg_recent_item_set_uri has ever seen this URI object. Well, but seeing, that gnome-vfs cannot process my handish registered rtsp schema, makes me wonder, if my steps to register the URI handler were sane.
Hmm, odd: Might be more like some kind of gnome-vfs problem? Dunno, but the following tiny program prints out "uri: (nil)"... #include <libgnomevfs/gnome-vfs.h> int main() { GnomeVFSURI *uri; gnome_vfs_init(); uri = gnome_vfs_uri_new( "rtsp://stream1.rbb-online.de/broadcast/fritz-live.ra"); printf("uri: %p\n", uri); }
$ gconftool-2 -R /desktop/gnome/url-handlers/rtsp command = /usr/bin/mplayer '%s' type = true description = Real Time Streaming Protocol command-id = a38a8d21-b1d5-429a-abbf-3eb5c9e6c01b enabled = true $
Grr, I am tired, forgot to tell you the version of "my" gnome-panel and gnome-vfs: Both are 2.7.90.
Created attachment 30572 [details] The evil .desktop file
Hmm... After reading the code in gnome-vfs-uri.c I am sure, that the egg-code is wrong, cause it assumes, that gnome_vfs_uri_new processes any particulary sane URI*). But in reallity (and for properly good reasons) gnome_vfs_uri_new only accepts URI which's URI scheme is backed by some gnome-vfs module. *) rtps: or mms: URIs definitly are sane in my opition. Nevertheless no gnome-vfs module is needed for handling them.
See also: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=129658 Crash is caused by: <RecentItem> <URI>x-nautilus-desktop:///home</URI> <Mime-Type>application/octet-stream</Mime-Type> <Timestamp>1092226462</Timestamp> <Groups> </Groups> </RecentItem> Basically, x-nautilus-desktop: is a method which gnome-vfs doesn't handle and so gnome_vfs_uri_new() returns NULL triggering an assertion in egg_recent_item_get_short_name() The assertion isn't valid because gnome_vfs_make_uri_from_input() in egg_recent_item_set_uri() returns a valid URI even if it doesn't recognise the method in the URI. Attaching a patch which allows get_short_name() to fail and just doesn't add a menu item if it does fail.
Created attachment 30633 [details] [review] patch Federico: look okay to you ?
Well, guess the main problem is, that the GnomeVFSURI-API, which is designed for URIs manageable by GNOME-VFS only, is *abused* to handle some generic URIs. Is there some generic URI handling code in the GNOME Framework, somewhere? If not we should consider some long-term solution (for GNOME 2.10), like adding some generic URI API to GLib.
@Mark: Somehow dislike the patch: Too much code for some imperfect work-arround. Maybe I should try to extract the relevant URI code from GNOME-VFS, make it generic and add it to libegg - or is it too late for such a step, at the current freeze state of GNOME 2.8?
Ah, I see what you're saying - its not the list of protocols which gnome-vfs has methods for, but rather the list of protocols for which we have a URI handler. Certainly sounds like some work is needed in gnome-vfs for that ... Anyway, the patch just stops the panel crashing, which is what's important for 2.8. Its only a large patch because I cleaned up egg_recent_view_gtk_new_menu_item() while I was at it by moving the separator creation to another function and not leaking a EggRecentViewGtkMenuData when creating a separator. The only important change is: + if (!short_name) + return NULL;
@mark: Ah, I see. So this patch is some double patch. Well, actually if URI parsing is kept in GNOME-VFS - which is pretty ok - for 2.8, all that would be needed, would be to export the currently static gnome_vfs_uri_new_private function. Or we build some wrapper function. Problem: Since this kind of changes semantics of some URI, we would have to check all GNOME-VFS functions accepting URIs, if they get along with generic URIs. Those functions which need some module behind the URI should bail out via g_return_fail. Alternative hack: Some dummy module for GNOME-VFS which is meant to be put behind generic URIs and behaves like /dev/null and /dev/zero. Nevertheless both aproaches are hacks, and some generic URI parsing API, outside of GNOME-VFS should be considered: Have been faced by the problem of not finding such an API in GNOME before already. But guess this would have to be discussed on one of the mailing lists.
Mark: patch looks good to me
Thanks: 2004-08-17 Mark McLoughlin <mark@skynet.ie> Fix for bug #150218 - panel crashing when you've got URI's like "x-nautilus-desktop:///home" in your ~/.recently-used. * libegg/recent-files/egg-recent-item.c: (egg_recent_item_get_short_name): remove assertion. * libegg/recent-files/egg-recent-view-gtk.c: (egg_recent_view_gtk_new_separator): split out the separator creation from new_menu_item(). (egg_recent_view_gtk_new_menu_item): don't add a menu item if we can't obtain a short name. (egg_recent_view_gtk_add_to_menu): upd. Matthias: the crasher is fixed now, but it would be good if you opened another bug describing the problem you point out - that uris like rtsp:// don't get displayed even if there is a URL handler for them