Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

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:
Embargoed:

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.