GNOME Bugzilla – Bug 339904
Handle incorrectly encoded .desktop files ?
Last modified: 2006-11-02 11:42:32 UTC
That bug has been opened on https://launchpad.net/distros/ubuntu/+source/nautilus/+bug/41261 "Start Nautilus, select a directory or file; use File, Open With Other Application menu; or use right-click Open With Other Application; nautilus crashes. Bug Buddy pops up, but also crashes when choosing Inform Developers. On up to date Dapper on IBM Thinkpad R51. ... > Could you get a backtrace using gdb with libglib2.0-0-dbg libgnomevfs2-0-dbg nautilus-dbg installed? ...
+ Trace 67874
and attach openwith.log to the bug? ... http://librarian.launchpad.net/2380744/openwith.log"
Hello. I have found exactly this problem after upgrading from debian stable to debian etch. I do not know if some file remaining from the old version may trigger the crash. Nautilus crashes when right-button-clicking on a file and select "open with other application". Then the system tries to open bug-buddy to "notify the developers" and bug-buddy also crashes. By the way, bug-buddy also crashes when it is opened "stand-alone". I am attaching the file obtained with: MENU_VERBOSE=1 bug-buddy &>bug-buddy-crash.log in case it may help in some way.
Created attachment 66610 [details] Log file of bug-buddy crash (gzip compressed)
I think I have found the origin of the crash. There were several *.desktop files in the subdirectories of /usr/share/gnome/apps that were iso-8859-1 encoded without a Encoding line in them. When bug-buddy (or Nautilus or eel or whatever) reads the file, as Encoding is not specified, it uses the default (apparently UTF-8) which is not the case and the crash happens. I have edited all these files and added the line Encoding=ISO-8859-1 at the beginning. The problem has vanished (it would probably also work convert the files to UTF-8). In any case, I think it is still a bug that should be fixed, if the *.desktop files are not correct (in this case, the Encoding is not indicated), the program that reads them may print some sort of warning or error message (even gracefully exiting) so that the problem may be easily identified and fixed by the user but it should not crash. Hope this indication helps.
I can't seem to reproduce this. Could you provide a .desktop file that can cause the crash please?
I am attaching a GIMP.desktop file, which is one of those that triggers the crash. I think this file came with the distribution Linex (www.linex.org, based on Debian woody) which changed the name of the program GIMP by the name of a Spanish painter of the XVII-XVIII century. When I upgraded to Debian etch, the bug showed up (this .desktop file had probably become obsolete, but it remained there after the upgrade!). The crash is deactivated either adding the Encoding=ISO-8859-1 line at the start of the file or removing the accented "a" from the Name line (this seems to be the important item). The accented "a" may be left at the Name[es] line, it does not seem to be a problem there. The accented letters at the Comment line do not seem to pose any problem either.
Created attachment 67854 [details] desktop file that triggers the crash
Created attachment 67857 [details] [review] Patch to correct the bug This patch appears to correct the problem. However, we've now got a separate warning from gnome-menus telling us "GLib-CRITICAL **: g_utf8_collate: assertion `str2 != NULL' failed", but that's another matter entirely...
Thanks, it's on HEAD for the 2.15.4 release. I've also fixed a similar issue in compare_applications which I think was the source of the critical warnings. 2006-07-11 Martin Wehner <martin.wehner@gmail.com> * eel/eel-open-with-dialog.c: (compare_applications), (eel_open_with_dialog_add_items_idle): Handle entry name == NULL without crashing. (#339904) Based on a patch from Miguel Quiros <mquiros@ugr.es> I'm not closing, but reassigning to gnome-menus as I suspect this could be handled more elegantly on their side.
So, to summarise: + the .desktop file had no encoding specified + the Name and Name[es] keys of the .desktop did not contain valid UTF-8 + gmenu_tree_entry_get_name() returned NULL Okay, should be fixed on HEAD and gnome-2-16 now: 2006-11-02 Mark McLoughlin <mark@skynet.ie> * libmenu/desktop-entries.c: (desktop_entry_load): don't load a .desktop file which contains an incorrectly encoded Name key. Fixes bug #339904