apport-retrace crashed with UnicodeEncodeError in exit()

Bug #448158 reported by d1bro
94
This bug affects 13 people
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: apport

on karmic

apport-retrace:
  Installiert: 1.9.2-0ubuntu2
  Kandidat: 1.9.2-0ubuntu2
  Versions-Tabelle:
 *** 1.9.2-0ubuntu2 0
        500 http://archive.ubuntu.com karmic/main Packages
        100 /var/lib/dpkg/status

simply called apport-retrace in terminal without options or any files. It spitted out following:

Traceback (most recent call last):
  File "/usr/bin/apport-retrace", line 195, in <module>
    (reportfile, options) = parse_options()
  File "/usr/bin/apport-retrace", line 78, in parse_options
    optparser.error(_('incorrect number of arguments; use --help for a short help'))
  File "/usr/lib/python2.6/optparse.py", line 1578, in error
    self.exit(2, "%s: error: %s\n" % (self.get_prog_name(), msg))
  File "/usr/lib/python2.6/optparse.py", line 1567, in exit
    sys.stderr.write(msg)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 26: ordinal not in range(128)

ProblemType: Crash
ApportLog:
 apport (pid 27502) Sat Oct 10 19:29:42 2009: called for pid 27491, signal 6
 apport (pid 27502) Sat Oct 10 19:29:42 2009: executable: /usr/games/bygfoot (command line "bygfoot")
 apport (pid 27502) Sat Oct 10 19:29:48 2009: wrote report /var/crash/_usr_games_bygfoot.1000.crash
Architecture: i386
Date: Sat Oct 10 19:35:59 2009
DistroRelease: Ubuntu 9.10
ExecutablePath: /usr/bin/apport-retrace
InterpreterPath: /usr/bin/python2.6
NonfreeKernelModules: nvidia
Package: apport-retrace 1.9.2-0ubuntu2
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/bin/apport-retrace
ProcEnviron:
 SHELL=/bin/bash
 LANG=de_DE.UTF-8
ProcVersionSignature: Ubuntu 2.6.31-13.42-generic
PythonArgs: ['/usr/bin/apport-retrace']
SourcePackage: apport
Title: apport-retrace crashed with UnicodeEncodeError in exit()
Uname: Linux 2.6.31-13-generic i686
UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare

Revision history for this message
d1bro (d1bro) wrote :
tags: removed: need-duplicate-check
Revision history for this message
Philip Muškovac (yofel) wrote :

Confirmed by duplicates.

visibility: private → public
Changed in apport (Ubuntu):
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
yamo (stephane-gregoire) wrote :

Hi,
I had this bug on lucid.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 10.04.1 LTS
Release: 10.04
Codename: lucid

$ dpkg -l apport-retrace | grep ii
ii apport-retrace 1.13.3-0ubuntu2 tools for reprocessing Apport crash reports

Revision history for this message
Braiam Peguero (braiampe) wrote :

It could have a better handle of the no-options and invalid options. Instead of a error can be something like:

apport-retrace
No options given. Please, use apport-retrace --help to get a complete list of options.

or

Invalid option. Run apport-retrace --help to get a complete list of options.

Revision history for this message
Philip Muškovac (yofel) wrote :

if no option is given apport prints the following:
$ apport-retrace
Usage: apport-retrace [options] <apport problem report | crash ID>

apport-retrace: error: incorrect number of arguments; use --help for a short help

it tries to do exactly that in karmic and lucid too, but seems to crash with that UnicodeError for some reason.

Revision history for this message
Philip Muškovac (yofel) wrote :

Ok, after some debugging it turnes out that python2.6 sys.stderr.write() can't handle unicode characters that aren't converted to bytes first:

sys.stderr.write(str(u'\xfc'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 0: ordinal not in range(128)

sys.stderr.write(u'\xfc'.encode('utf-8'))
ü

Changed in apport (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Braiam Peguero (braiampe) wrote :

So it could be a bug in python too?

Revision history for this message
Philip Muškovac (yofel) wrote :

Possibly, I'm not an expert about python, and the guys in #python said that 2.6 write() doesn't support unicode and you have to convert it. I'm not sure if that's just a workaround or the intended behaviour. 2.7 works fine with unicode btw. and output in python 3 seems to work differently.

Revision history for this message
Martin Pitt (pitti) wrote :

I can still replicate with "python2.6 /usr/bin/apport-retrace", but python2.7 apparently has this fixed. As 2.7 is the default in natty, I'm closing this now. Thanks!

Changed in apport (Ubuntu):
status: Triaged → Fix Released
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.