After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 339904 - Handle incorrectly encoded .desktop files ?
Handle incorrectly encoded .desktop files ?
Status: RESOLVED FIXED
Product: gnome-menus
Classification: Core
Component: libgnome-menu
2.14.x
Other Linux
: Normal critical
: ---
Assigned To: gnome-menus dummy account
gnome-menus dummy account
Depends on:
Blocks:
 
 
Reported: 2006-04-27 11:03 UTC by Sebastien Bacher
Modified: 2006-11-02 11:42 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
Log file of bug-buddy crash (gzip compressed) (93.83 KB, application/x-compressed-tar)
2006-06-01 17:00 UTC, Miguel Quiros
  Details
desktop file that triggers the crash (203 bytes, text/plain)
2006-06-22 16:47 UTC, Miguel Quiros
  Details
Patch to correct the bug (503 bytes, patch)
2006-06-22 17:16 UTC, palfrey
committed Details | Review

Description Sebastien Bacher 2006-04-27 11:03:03 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?
...
  • #0 strcmp
    from /lib/tls/i686/cmov/libc.so.6
  • #1 eel_open_with_dialog_add_items_idle
    at eel-open-with-dialog.c line 597
  • #2 g_idle_dispatch
    at gmain.c line 3796
  • #3 IA__g_main_context_dispatch
    at gmain.c line 1916
  • #4 g_main_context_iterate
    at gmain.c line 2547
  • #5 IA__g_main_loop_run
    at gmain.c line 2751
  • #6 gtk_main
    from /usr/lib/libgtk-x11-2.0.so.0
  • #7 main
    at nautilus-main.c line 406
  • #8 __libc_start_main
    from /lib/tls/i686/cmov/libc.so.6
  • #9 _start
    at ../sysdeps/i386/elf/start.S line 119

and attach openwith.log to the bug?
...
http://librarian.launchpad.net/2380744/openwith.log"
Comment 1 Miguel Quiros 2006-06-01 16:57:40 UTC
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.
Comment 2 Miguel Quiros 2006-06-01 17:00:43 UTC
Created attachment 66610 [details]
Log file of bug-buddy crash (gzip compressed)
Comment 3 Miguel Quiros 2006-06-10 08:00:55 UTC
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.
Comment 4 palfrey 2006-06-22 11:27:25 UTC
I can't seem to reproduce this. Could you provide a .desktop file that can cause the crash please?
Comment 5 Miguel Quiros 2006-06-22 16:45:14 UTC
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.
Comment 6 Miguel Quiros 2006-06-22 16:47:01 UTC
Created attachment 67854 [details]
desktop file that triggers the crash
Comment 7 palfrey 2006-06-22 17:16:50 UTC
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...
Comment 8 Martin Wehner 2006-07-10 23:17:56 UTC
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.
Comment 9 Mark McLoughlin 2006-11-02 11:42:32 UTC
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