software-properties-kde crashed with error " 'utf8' codec can't decode bytes in position 27-28"

Bug #133937 reported by Jeremy Wilkins on 2007-08-21
94
This bug affects 5 people
Affects Status Importance Assigned to Milestone
gnupg (Debian)
Fix Released
Unknown
gnupg (Ubuntu)
Undecided
Unassigned
Intrepid
Undecided
Unassigned
software-properties (Ubuntu)
Medium
Unassigned
Intrepid
Medium
Unassigned

Bug Description

The traceback is as follows:
Traceback (most recent call last):
  File "/usr/bin/software-properties-kde", line 92, in <module>
    app = SoftwarePropertiesKDE(datadir=data_dir, options=options, file=file)
  File "/usr/lib/python2.5/site-packages/softwareproperties/kde/SoftwarePropertiesKDE.py", line 85, in __init__
    self.show_keys()
  File "/usr/lib/python2.5/site-packages/softwareproperties/kde/SoftwarePropertiesKDE.py", line 576, in show_keys
    self.userinterface.treeview2.addTopLevelItem(QTreeWidgetItem([unicode(key, 'UTF-8')]))
  File "encodings/utf_8.py", line 16, in decode
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 27-28: invalid data

This happens whenever I try to run software-properties-kde whether by itself or under adept..

Jeremy Wilkins (wjeremy) wrote :

My sources aren't anything unusual I don't think, but please enlighten me if I am wrong.

Jeremy Wilkins (wjeremy) wrote :

I just noticed that this is the same old problem where software-properties-kde isn't handling keys with special characters. (Python UTF-8 handling crashes). The offending keys:

pub 1024D/3714DD6A 2005-05-16
uid Michal Čihař (Automated Debian packages builds) <email address hidden>
sub 2048g/5D11820B 2005-05-16

pub 1024D/81836EBF 2006-06-26
uid Treviño (3v1n0) <email address hidden>
uid Marco Trevisan <email address hidden>
uid Treviño Ubuntu Repository <email address hidden>
sub 1024D/DD800CD9 2006-10-19
sub 4096g/EDD1E155 2006-06-26

Daniel Hahler (blueyed) wrote :

So the error is caused by the (encoding/content of the) keys, right?
Is there another bug report for "the same old problem" (which you've mentioned)?

Can you fix it by removing (some) keys, e.g. using "apt-key del" (after backing up /etc/apt/trust*).

From the traceback it looks like it expects the data to be UTF-8 encoded, but it's not.

Is this with Gutsy or Feisty?

Changed in software-properties:
status: New → Incomplete

On Tuesday 21 August 2007 6:02:21 pm dAniel hAhler wrote:
> So the error is caused by the (encoding/content of the) keys, right?
> Is there another bug report for "the same old problem" (which you've
> mentioned)?
>
> Can you fix it by removing (some) keys, e.g. using "apt-key del" (after
> backing up /etc/apt/trust*).
>
> >From the traceback it looks like it expects the data to be UTF-8
>
> encoded, but it's not.
>
> Is this with Gutsy or Feisty?
>
> ** Changed in: software-properties (Ubuntu)
> Status: New => Incomplete

Yes, the problem can be resolved by removing the offending keys. However, the
problem really lies with character encoding not being treated properly. This
is in Feisty's version of adept... I have not tested Gutsy to determine if
the problem was resolved there, but I had heard that it was.

--
Jeremy Wilkins

Daniel Hahler (blueyed) wrote :

It is not fixed in Gutsy.

I could now reproduce it, after adding the key 0x3714DD6A to my apt keyring.

It appears like the encoding of the key itself is invalid and software-properties-kde should handle this better (by ignoring it). At least KGpg displays the key desc "scrambled", while "apt-key list" displays it correctly.

I will attach the offending key, so that you can test it easily.

After "sudo apt-key add 0x3714DD6A.pub.gpg" I get the "Installer crashed"(?) dialog with the same traceback.

Changed in software-properties:
status: Incomplete → Confirmed
Daniel Hahler (blueyed) wrote :

A workaround for this problem might be to use errors="replace" in line 576 of softwareproperties/kde/SoftwarePropertiesKDE.py:
      self.userinterface.treeview2.addTopLevelItem(QTreeWidgetItem([unicode(key, 'UTF-8', 'replace')]))

However, the root cause might be somewhere else!

I'm wondering why "apt-key list" has no problem displaying this key (in a utf-8 shell).

karaluh (karaluh) wrote :

Not fixed in Intrepid:
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 32-33: invalid data

Daniel Hahler (blueyed) on 2008-10-29
Changed in software-properties:
importance: Undecided → Medium
status: Confirmed → Triaged
Jonathan Riddell (jr) wrote :
Jonathan Riddell (jr) wrote :

Uploaded to intrepid-proposed, waiting approval.

TEST CASE: start software-properties-kde, import this key http://launchpadlibrarian.net/9093357/0x3714DD6A.pub.gpg will give backtrace in previous version (new version still shows character corrupt but that's consistent with the gtk frontend).

Martin Pitt (pitti) wrote :

Accepted into intrepid-proposed, please test and give feedback here. Please see https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in software-properties:
status: Triaged → Fix Committed
karaluh (karaluh) wrote :

I can confirm this bug fixed, tested on my own not working keys, not the one provided here.

Martin Pitt (pitti) wrote :

Copied intrepid-proposed version to jaunty.

Changed in software-properties:
status: Fix Committed → Fix Released
Martin Pitt (pitti) wrote :

Copied to intrepid-updates.

Changed in software-properties:
status: Fix Committed → Fix Released
Terence Simpson (tsimpson) wrote :

This bug has reappeared in karmic

Changed in software-properties (Ubuntu):
status: Fix Released → Confirmed
Terence Simpson (tsimpson) wrote :

This should stop the error from happening, it's also possible to use 'replace' rather than 'ignore'

amichair (amichai2) wrote :

The bug is upstream: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=540340
(still need to verify that software-properties-* works correctly once fixed gnupg version is here)

amichair (amichai2) on 2009-11-23
Changed in software-properties (Ubuntu):
status: Confirmed → Fix Committed
amichair (amichai2) on 2009-11-23
Changed in gnupg (Ubuntu Intrepid):
status: New → Invalid
Changed in gnupg (Ubuntu):
status: New → Fix Committed
Changed in software-properties (Ubuntu Intrepid):
status: Fix Released → Invalid
Jonathan Thomas (echidnaman) wrote :

The fixed gnupg package is now in Ubuntu.

Changed in gnupg (Ubuntu):
status: Fix Committed → Fix Released
Jonathan Thomas (echidnaman) wrote :

...and confirming here that s-p-kde is fixed in lucid! :D

Changed in software-properties (Ubuntu):
status: Fix Committed → Fix Released
Changed in gnupg (Debian):
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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