mate-desktop / mozo

Menu editor for MATE using the freedesktop.org menu specification
http://www.mate-desktop.org
GNU Lesser General Public License v2.1
28 stars 12 forks source link

mozo crashes silently, killing mate-applications.menu #28

Closed HansPL closed 8 years ago

HansPL commented 8 years ago

See also https://forums.linuxmint.com/viewtopic.php?f=238&t=226861 — using LMDE2 x64 Mate: Since yesterday, my mozo crashes silently (nothing opens), mate-applications.menu is left empty (0 bytes). The following traceback in terminal after restoring an old mate-applications.menu.undo-70:

me@here1:~/tmp$ mozo
Traceback (most recent call last):
  File "/usr/bin/mozo", line 36, in <module>
    main()
  File "/usr/bin/mozo", line 32, in main
    app = MainWindow(datadir, version, sys.argv)
  File "/usr/lib/python2.7/dist-packages/Mozo/MainWindow.py", line 54, in __init__
    self.editor = MenuEditor()
  File "/usr/lib/python2.7/dist-packages/Mozo/MenuEditor.py", line 36, in __init__
    self.__loadMenus()
  File "/usr/lib/python2.7/dist-packages/Mozo/MenuEditor.py", line 63, in __loadMenus
    self.save(True)
  File "/usr/lib/python2.7/dist-packages/Mozo/MenuEditor.py", line 68, in save
    fd.write(re.sub("\n[\s]*([^\n<]*)\n[\s]*</", "\\1</", getattr(self, menu).dom.toprettyxml().replace('<?xml version="1.0" ?>\n', '')))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 4696: ordinal not in range(128) 

Greping for hex fc or U+252 in ~/.config/menus and ~/.local/share/applications found nothing. Editing existing menu entries via right-click in mintmenu still works.
Any ideas, someone? BTW, mozo here seemed do stop making backup copies mate-applications.menu.undo-* in 2014 — is that intended?

HansPL commented 8 years ago

Using strace -e trace=open -omozo.trace mozo I find that mozo crashes after opening mate-applications.menu. This file is a perfectly valid utf8 text. In its mentioned position dec 4696 there is no u'\xfc' but a German umlaut 'ü' (hex c3bc). Replacing all umlauts ü → ue etc. and mozo starts up fine again! Showing other umlauts in menu tiles and entries. What the —? This worked for years before!
There is a /var/cache/apt/archives/mozo_1.14.0-1+betsy_all.deb dated 2016-04-27, nothing older. It is well possible that I did not use mozo since then until recently so I blame that update — I don't know what I had before, installed with Mint.

HansPL commented 8 years ago

Summarized: mozo 1.14.0 crashes reproducibly, destroying mate-applications.menu, if that file contains entries with »ü«. (Or, presumably, other non-ASCII utf8 characters.) Reproduced on other machines. To reproduce, just edit one of the Filename nodes in ~/.config/menus/mate-applications.menu adding an »ü«, then start mozo. Don't forget to keep a backup of your file…

XRevan86 commented 8 years ago

Duplicate of #29.