software-properties-gtk crashed with UnicodeDecodeError in init_distro(): 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

Bug #815480 reported by Ivan Akulov on 2011-07-24
304
This bug affects 46 people
Affects Status Importance Assigned to Milestone
software-properties (Ubuntu)
High
Unassigned
Oneiric
High
Unassigned

Bug Description

.

ProblemType: Crash
DistroRelease: Ubuntu 11.10
Package: software-properties-gtk 0.81.2
ProcVersionSignature: Ubuntu 3.0.0-6.7-generic 3.0.0-rc7
Uname: Linux 3.0.0-6-generic i686
NonfreeKernelModules: fglrx
Architecture: i386
Date: Sun Jul 24 19:38:18 2011
ExecutablePath: /usr/bin/software-properties-gtk
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Alpha i386 (20110705)
InterpreterPath: /usr/bin/python2.7
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/bin/software-properties-gtk --open-tab 2
ProcEnviron:
 PATH=(custom, no user)
 LANG=ru_UA.UTF-8
 LANGUAGE=ru_UA:ru
 SHELL=/bin/bash
PythonArgs: ['/usr/bin/software-properties-gtk', '--open-tab', '2']
SourcePackage: software-properties
Title: software-properties-gtk crashed with UnicodeDecodeError in init_distro(): 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
UpgradeStatus: Upgraded to oneiric on 2011-07-17 (7 days ago)
UserGroups:

Ivan Akulov (gxoptg) wrote :
visibility: private → public
Changed in software-properties (Ubuntu):
status: New → Confirmed
Bowmore (bowmore) wrote :

I have the same issue for versions 0.81.2-0.81.4.
software-properties-gtk crashed with UnicodeDecodeError in init_distro(): 'ascii' codec can't decode byte 0xc3 in position 13: ordinal not in range(128)

It seems to be an ascii vs unicode issue introduced in version 0.81.2

A workaround atm is to downgrade to version 0.80.13.

L!S (andrew.lisichenko) wrote :

error appeared when trying to select "settings" in update manager.

Sebastien Bacher (seb128) wrote :

Confirmed on oneiric alpha3 with zn_CH locale

$ LANGUAGE=zh_CN gettext software-properties "%s Software"
%s 软件s

$ LANGUAGE=zh_CN python -c "import gettext; gettext.textdomain('software-properties'); print gettext.gettext('%s Software')"
%s 软件

but it breaks in software-properties

Changed in software-properties (Ubuntu):
importance: Undecided → High
Sebastien Bacher (seb128) wrote :

doing a print _("%s Software") % self.distro.id in SoftwarePropertiesGtk.py had the same issue than the set label call, but adding .encode('utf-8') makes it work...

Dmitry Tantsur (divius) wrote :

Devs should repeat 10 times: "I will never ever mix unicode and bytestrings. Especially in translatable strings." =(((

tags: added: patch
Evger (evger) wrote :

patch works

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package software-properties - 0.81.6

---------------
software-properties (0.81.6) oneiric; urgency=low

  [ Michael Vogt ]
  * softwareproperties/ppa.py:
    - show PPA description and confirm before adding
      (security-o-catch-all spec)

  [ Martin Pitt ]
  * softwareproperties/gtk/SoftwarePropertiesGtk.py: Fix encoding error,
    thanks to sokolov-m-v for the patch! (LP: #815480)
 -- Martin Pitt <email address hidden> Mon, 15 Aug 2011 10:25:51 +0200

Changed in software-properties (Ubuntu Oneiric):
status: Confirmed → Fix Released
Zooko Wilcox-O'Hearn (zooko) wrote :

By the way, this patch replaced a regexp with json.loads(): http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/quantal/software-properties/quantal/revision/77

That was good, because a regexp could have been vulnerable to some sort of xss/injection sort of problem. But, the patch mistakenly left the following no-longer-true comment in place:

    # we ask for a JSON structure from lp_page, we could use
    # simplejson, but the format is simple enough for the regexp

That comment should be removed.

Michael Vogt (mvo) wrote :

Thanks Zooko, I removed the no longer applying comment from the source now.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers