crashed with UnicodeEncodeError in apport_excepthook(): 'ascii' codec can't encode character u'\xe8' in position 166: ordinal not in range(128)

Bug #972436 reported by Stevemary on 2012-04-03
This bug affects 2 people
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Martin Pitt
Martin Pitt

Bug Description

SRU test case:
 - Modify /usr/bin/software-properties (or any other installed Python app really, add these two lines right after the first one:
  # coding: UTF-8
  raise ValueError(u'♥')

 - Run software-properties-gtk from a Terminal.
 - Curent version: You will see the exception from this bug in, and no crash report generated.
 - Fixed version: You just see the ValueError in the terminal, and /var/crash/ gets a bug report generated.

REGRESSION POTENTIAL: Negligible. Both this new as well as several already working cases are covered by tests.

ProblemType: Crash
DistroRelease: Ubuntu 12.04
Package: update-notifier-common 0.119ubuntu1
ProcVersionSignature: Ubuntu 3.2.0-21.34-generic-pae 3.2.13
Uname: Linux 3.2.0-21-generic-pae i686
ApportVersion: 2.0-0ubuntu3
Architecture: i386
Date: Tue Apr 3 15:14:46 2012
ExecutablePath: /usr/lib/update-notifier/
InstallationMedia: Ubuntu-Studio 11.10 "Oneiric Ocelot" - Release i386 (20111011.1)
InterpreterPath: /usr/bin/python2.7
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/lib/update-notifier/ install_all_updates
PythonArgs: ['/usr/lib/update-notifier/', 'install_all_updates']
SourcePackage: update-notifier
Title: crashed with UnicodeEncodeError in apport_excepthook(): 'ascii' codec can't encode character u'\xe8' in position 166: ordinal not in range(128)
UpgradeStatus: Upgraded to precise on 2012-04-03 (0 days ago)
UserGroups: adm admin audio cdrom dialout lpadmin plugdev sambashare
mtime.conffile..etc.apt.apt.conf.d.10periodic: 2011-12-13T00:17:50.520984

Stevemary (stevemary78) wrote :
tags: removed: need-duplicate-check
Steve Langasek (vorlon) on 2012-04-10
affects: update-notifier (Ubuntu) → apport (Ubuntu)
Changed in apport (Ubuntu):
importance: Undecided → Medium
Sebastien Bacher (seb128) wrote :

Hey Martin, is there any chance you cool at this issue? It got reported 778 times on so far in July which makes it issue n°19 on Ubuntu at the moment, it would be nice to see if we can get it fixed for the LTS .1

visibility: private → public
Changed in apport (Ubuntu Precise):
assignee: nobody → Martin Pitt (pitti)
importance: Undecided → High
status: New → Confirmed
milestone: none → ubuntu-12.04.1
Sebastien Bacher (seb128) wrote :

backtrace from one of the recent reports

"Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/defer/", line 389, in _next
    self.result = callback(self.result, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/defer/", line 531, in gotResult
    _inline_callbacks(res, gen, deferred)
  File "/usr/lib/python2.7/dist-packages/defer/", line 521, in _inline_callbacks
  File "/usr/lib/python2.7/dist-packages/defer/", line 351, in errback
  File "/usr/lib/python2.7/dist-packages/defer/", line 407, in _next
  File "/usr/lib/python2.7/dist-packages/", line 55, in apport_excepthook
    if 'org.freedesktop.DBus.Error.NoReply' in str(exc_obj):
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 62: ordinal not in range(128)"

Martin Pitt (pitti) wrote :

I updated the test suite to reproduce this. It does not happen any more with Python 3, so it is not an issue in Quantal.

Changed in apport (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
status: New → In Progress
Martin Pitt (pitti) wrote :

Fixed in trunk r2426.

Changed in apport (Ubuntu):
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.3-0ubuntu1

apport (2.3-0ubuntu1) quantal; urgency=low

  * New upstream release:
    - Rework test suite to not use Launchpad's +storeblob
      facility at all any more. It almost never works on staging and is
      horribly slow. Fake the bug creation from a blob by manually creating
      the comment and attachments ourselves, and just assume that storeblob
      works on production. Also change the structure to allow running every
      test individually.
    - crash-digger: Add --crash-db option to specify a non-default crash
      database name. (LP: #1003506)
    - apport-gtk: Add --hanging option to specify the process ID of a hanging
      application. If the user chooses to report this error, apport will
      terminate the pid with SIGABRT, otherwise it will send SIGKILL. The
      normal core pipe handler will be used to process the resulting report
      file, with a .hanging file in /var/crash to separate these from regular
    - apport: Also treat a binary as modified if the /proc/pid/exe symlink
      does not point to an existing file any more. (LP: #984944)
    - Fix PEP-8 violations picked up by latest pep8 checker.
    - Do not ignore certain exceptions during upload which are not
      likely to be a network error.
    - Recongize Launchpad projects for bug query and marking
      operations. (LP: #1003506)
    - Fix get_source_tree() to work with apt sandboxes.
    - apport-retrace: Turn StacktraceSource generation back on, now that it
      works with the current sandboxing.
    - Ensure that upload chunk size does not underrun.
      (LP: #1013334)
    - apport_python_hook: Fix UnicodeEncodeError crash with Python 2 for
      exceptions with non-ASCII characters. (LP: #972436)
    - Fix occasional test failure in test_1_crash_details if
      the application ends before the "is progress bar visible" check is done.
 -- Martin Pitt <email address hidden> Mon, 09 Jul 2012 08:14:30 +0200

Changed in apport (Ubuntu):
status: Fix Committed → Fix Released
Martin Pitt (pitti) wrote :

The fix can be backported with ease, but right now it is blocked by the current SRU which needs to be verified first.

Changed in apport (Ubuntu Precise):
status: Confirmed → Triaged
Martin Pitt (pitti) on 2012-07-18
description: updated
description: updated
Changed in apport (Ubuntu Precise):
status: Triaged → In Progress
Martin Pitt (pitti) wrote :

I uploaded a fixed apport to the precise-proposed queue, now awaiting SRU team review.

Changed in apport (Ubuntu Precise):
importance: High → Critical
status: In Progress → Fix Committed
Stéphane Graber (stgraber) wrote :

Reverting the precise task to In Porogress, Fix Commited is for packages that are in the -proposed pocket, this package is still in the Unapproved queue.

Changed in apport (Ubuntu Precise):
status: Fix Committed → In Progress

Hello Stevemary, or anyone else affected,

Accepted apport into precise-proposed. The package will build now and be available at in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at . Thank you in advance!

Changed in apport (Ubuntu Precise):
status: In Progress → Fix Committed
tags: added: verification-needed
Brian Murray (brian-murray) wrote :

I was able to verify the fix and that a crash report was created, if apport is running, with version 2.0.1-0ubuntu12 from precise-proposed.

tags: added: verification-done
removed: verification-needed

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.0.1-0ubuntu12

apport (2.0.1-0ubuntu12) precise-proposed; urgency=low

  [ Martin Pitt ]
  * apport_python_hook: Fix UnicodeEncodeError crash with Python 2 for
    exceptions with non-ASCII characters. Backported from trunk r2426.
    (LP: #972436)

  [ Brian Murray ]
  * data/general-hooks/ collect /etc/default/grub on systems where a
    package failed to install during when updating grub (LP: #1006633)
 -- Brian Murray <email address hidden> Thu, 19 Jul 2012 10:53:25 -0700

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