Bug 1036849

Summary: Getting UnicodeDecodeError on attempting to delete a menu item.
Product: Red Hat Enterprise Linux 7 Reporter: Vitezslav Humpa <vhumpa>
Component: alacarteAssignee: Jasper St. Pierre <jstpierr>
Status: CLOSED CURRENTRELEASE QA Contact: Desktop QE <desktop-qa-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: mclasen
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 10:33:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Vitezslav Humpa 2013-12-02 18:30:01 UTC
Description of problem:
First of all, alacarte-3.7.90-1.el7.noarch is quite broken in current RHEL7 composes. This is only one issue of several. I've tried the latest alacarte-3.10.0-1 from F20 inside the latest EL7 build that seems to have some of these bugs fixed, so it would make sense to backport these fixes, as we can't just jump to a 3.10 version now. Not all are fixed though even in 3.10.

Trying to delete any menu item from any category except for 'Other' results in getting this traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 437, in on_delete_button_clicked
    self.on_edit_delete_activate(None)
  File "/usr/lib/python2.7/site-packages/Alacarte/MainWindow.py", line 286, in on_edit_delete_activate
    self.editor.deleteItem(item)
  File "/usr/lib/python2.7/site-packages/Alacarte/MenuEditor.py", line 275, in deleteItem
    self.writeItem(item, Hidden=True)
  File "/usr/lib/python2.7/site-packages/Alacarte/MenuEditor.py", line 408, in writeItem
    f.write(contents)
  File "/usr/lib64/python2.7/codecs.py", line 691, in write
    return self.writer.write(data)
  File "/usr/lib64/python2.7/codecs.py", line 351, in write
    data, consumed = self.encode(object, self.errors)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd8 in position 37: ordinal not in range(128)

The item of choice does not get removed, either from the list inside alacarte or the actual menu. I have an all default US-english settings throughout the system and GNOME, but it looks like that the error occurs thanks to having read all of the desktop file entries, thus including also the non-utf8 characters.

This was fixed in 3.10 by patching this line in MenuEditor.py

>>>>> #408: with codecs.open(path, 'w', 'utf8') as f:

to remove the utf8 restriction:

>>>>> with open(path, 'w') as f:

Version-Release number of selected component (if applicable):
alacarte-3.7.90-1.el7.noarch

Additional info:
With 3.10, the deletion happens as expected, however the alacarte itself still needs to be restarted to see the item gone from the list is that does not update.

Comment 1 Vitezslav Humpa 2013-12-03 08:23:36 UTC
Same happens also when checking/enabling a disabled menu item. Both is an issue only on installed system items, with a custom menu item deletion/enablement proceeds (as there would be no non-utf8 text in the desktop file to mar parsing).

Comment 3 Vitezslav Humpa 2013-12-16 12:01:27 UTC
Verified the backported fix removes this issue.

Comment 4 Ludek Smid 2014-06-13 10:33:13 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.