Main Menu editor destroys applications menu when processing a non-ASCII character.

Bug #1605761 reported by Luke Horwell
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Ubuntu MATE
Fix Released
Medium
Martin Wimpress 
mozo (Ubuntu)
Fix Released
Medium
Martin Wimpress 
Xenial
Won't Fix
Medium
Martin Wimpress 

Bug Description

There is a entry in my applications menu named "Life Is Strange™" (note the ™ character). When using the Main Menu editor to make adjustments to the layout of the menus, a serious error occurs while processing the ™ character and as a result, destroys the entire ~/.config/menus/mate-applications.menu file to 0 kB. Occurs in Ubuntu MATE 16.04.1.

A workaround is to rename the affecting program's name in a text editor before using the Main Menu tool.

This is the back trace from mate-panel:

---------------------

/usr/lib/python2.7/dist-packages/Mozo/MenuEditor.py:533: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if node.childNodes[0].nodeName == 'Filename' and node.childNodes[0].childNodes[0].nodeValue == filename:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/Mozo/MainWindow.py", line 430, in on_menu_tree_drag_data_received
    self.editor.copyItem(item, new_parent)
  File "/usr/lib/python2.7/dist-packages/Mozo/MenuEditor.py", line 298, in copyItem
    self.save()
  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', '')))
  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 15: ordinal not in range(128)

** (mate-panel:12720): WARNING **: Error loading menu layout from "/home/luke/.config/menus/mate-applications.menu": Error on line 1 char 1: Document was empty or contained only whitespace

---------------------

Revision history for this message
Luke Horwell (lah7) wrote :

This affects MATE 1.14. Another user could not reproduce this on 1.12, both of which run 16.04 LTS.

https://ubuntu-mate.community/t/main-menu-editor-destroys-menu-with-non-ascii-characters/7876

Revision history for this message
Martin Wimpress  (flexiondotorg) wrote :

Can you raise this issue upstream please.

  * https://github.com/mate-desktop/mozo

It is definitely a bug in Mozo not handling Unicode.

Changed in ubuntu-mate:
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Luke Horwell (lah7) wrote :
Revision history for this message
Luke Horwell (lah7) wrote :
Changed in ubuntu-mate:
status: Confirmed → Fix Committed
Revision history for this message
Vlad Orlov (monsta) wrote :

Ok, 1.14.1 is released with the fix.

Changed in ubuntu-mate:
assignee: nobody → Martin Wimpress (flexiondotorg)
Changed in mozo (Ubuntu Xenial):
milestone: none → xenial-updates
Changed in mozo (Ubuntu):
status: New → Fix Committed
importance: Undecided → Medium
Changed in ubuntu-mate:
importance: Low → Medium
Changed in mozo (Ubuntu Xenial):
importance: Undecided → Medium
assignee: nobody → Martin Wimpress (flexiondotorg)
Changed in mozo (Ubuntu):
assignee: nobody → Martin Wimpress (flexiondotorg)
Changed in mozo (Ubuntu Xenial):
status: New → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package mozo - 1.15.1-0ubuntu1

---------------
mozo (1.15.1-0ubuntu1) yakkety; urgency=medium

  * New upstream development release.

 -- Martin Wimpress <email address hidden> Fri, 09 Sep 2016 13:04:48 +0100

Changed in mozo (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Vlad Orlov (monsta) wrote :

In regard to ubuntu-mate entry, it can be considered fixed.

Changed in ubuntu-mate:
status: Fix Committed → Fix Released
Changed in mozo (Ubuntu Xenial):
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.