Alacarte breaks menu configuration when .desktop filename contains unexpected characters
Arch Linux, alacarte 3.11.91+12+g1bb265f7-3
- Create
something-like-terminal.desktop
in~/.local/share/applications
with:
[Desktop Entry]
Name=Something like terminal
Comment=Use the command line
Exec=gnome-terminal
Icon=org.gnome.Terminal
Type=Application
Categories=GNOME;GTK;System;TerminalEmulator;
- Run Alacarte and try to hide this menu item. It works.
- Go to
~/.local/share/applications
and rename that .desktop file for example by adding—
(long dash) orę
(Polish character) to that name. - Run Alacarte and try to hide that menu items.
- Alacarte breaks XML configuration of menu. All user customization is lost.
~/.config/menus/gnome-applications.menu
file is broken, it's empty. Error is thrown:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 357, in on_item_tree_show_toggled
self.editor.setVisible(item, False)
File "/usr/lib/python2.7/site-packages/Alacarte/MenuEditor.py", line 195, in setVisible
self.save()
File "/usr/lib/python2.7/site-packages/Alacarte/MenuEditor.py", line 57, in save
f.write(self.dom.toprettyxml())
File "/usr/lib/python2.7/xml/dom/minidom.py", line 61, in toprettyxml
return writer.getvalue()
File "/usr/lib/python2.7/StringIO.py", line 271, in getvalue
self.buf += ''.join(self.buflist)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/Alacarte/MenuEditor.py", line 53, in menuChanged
self.load()
File "/usr/lib/python2.7/site-packages/Alacarte/MenuEditor.py", line 49, in load
if not self.tree.load_sync():
gi.repository.GLib.Error: g-markup-error-quark: Error on line 1 char 1: Document was empty or contained only whitespace (1)
** (alacarte:9812): CRITICAL **: 19:49:54.328: gmenu_tree_get_root_directory: assertion 'tree->loaded' failed
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 71, in menuChanged
self.loadUpdates()
File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 100, in loadUpdates
self.loadMenus()
File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 196, in loadMenus
self.loadMenu({ None: None })
File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 207, in loadMenu
name = cgi.escape(menu.get_name())
AttributeError: 'NoneType' object has no attribute 'get_name'
- Alacarte can't start anymore. Error:
/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py:22: PyGIWarning: GMenu was imported without specifying a version first. Use gi.require_version('GMenu', '3.0') before import to ensure that the right version gets loaded.
from gi.repository import Gtk, GdkPixbuf, Gdk, GMenu
(alacarte:9831): Gtk-CRITICAL **: 19:51:13.149: gtk_accel_label_set_accel_closure: assertion 'gtk_accel_group_from_accel_closure (accel_closure) != NULL' failed
(alacarte:9831): Gtk-CRITICAL **: 19:51:13.149: gtk_accel_label_set_accel_closure: assertion 'gtk_accel_group_from_accel_closure (accel_closure) != NULL' failed
Traceback (most recent call last):
File "/usr/bin/alacarte", line 24, in <module>
main()
File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 463, in main
app.setMenuBasename(basename)
File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 61, in setMenuBasename
self.editor = MenuEditor(menu_basename)
File "/usr/lib/python2.7/site-packages/Alacarte/MenuEditor.py", line 36, in __init__
self.load()
File "/usr/lib/python2.7/site-packages/Alacarte/MenuEditor.py", line 49, in load
if not self.tree.load_sync():
gi.repository.GLib.Error: g-markup-error-quark: Error on line 1 char 1: Document was empty or contained only whitespace (1)