Apport crashes when processing dump if environment variable contains utf-8 characters

Bug #1172638 reported by Stéphane Graber
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Fix Released
High
Martin Pitt

Bug Description

When doing a simple:
sh -c 'kill -SEGV $$'

Apport would crash and give me:
ERROR: apport (pid 5416) Thu Apr 25 11:27:48 2013: called for pid 5415, signal 11, core limit 0
ERROR: apport (pid 5416) Thu Apr 25 11:27:48 2013: Unhandled exception:
Traceback (most recent call last):
  File "/usr/share/apport/apport", line 328, in <module>
    info.add_proc_info(pid)
  File "/usr/lib/python3/dist-packages/apport/report.py", line 499, in add_proc_info
    self.add_proc_environ(pid, extraenv)
  File "/usr/lib/python3/dist-packages/apport/report.py", line 559, in add_proc_environ
    env = _read_file('/proc/' + pid + '/environ').replace('\n', '\\n')
  File "/usr/lib/python3/dist-packages/apport/report.py", line 74, in _read_file
    return fd.read().strip()
  File "/usr/lib/python3.3/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 387: ordinal not in range(128)
ERROR: apport (pid 5416) Thu Apr 25 11:27:48 2013: pid: 5416, uid: 0, gid: 0, euid: 0, egid: 0
ERROR: apport (pid 5416) Thu Apr 25 11:27:48 2013: environment: environ({})

This was tracked down to it not liking UTF-8 in the environment as Martin then reproduced with:
sh -c 'export LANG=ü; kill -SEGV $$'

ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: apport 2.9.2-0ubuntu8
ProcVersionSignature: Ubuntu 3.8.0-19.29-generic 3.8.8
Uname: Linux 3.8.0-19-generic x86_64
ApportVersion: 2.9.2-0ubuntu8
Architecture: amd64
Date: Thu Apr 25 11:30:12 2013
InstallationDate: Installed on 2013-04-21 (4 days ago)
InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Release amd64 (20130420)
MarkForUpload: True
PackageArchitecture: all
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: apport
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Stéphane Graber (stgraber) wrote :
Martin Pitt (pitti)
Changed in apport (Ubuntu):
status: New → In Progress
assignee: nobody → Martin Pitt (pitti)
importance: Undecided → High
Revision history for this message
Martin Pitt (pitti) wrote :

Fixed in trunk r2626.

Changed in apport (Ubuntu):
assignee: Martin Pitt (pitti) → nobody
status: In Progress → Fix Committed
assignee: nobody → Martin Pitt (pitti)
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

---------------
apport (2.10-0ubuntu1) saucy; urgency=low

  [ Martin Pitt ]
  * New upstream release. Changes since our previous snapshot:
    - Support retracing foreign powerpc reports, thanks Steve Langasek.
    - apport/report.py: Generate a crash signature for suspend/resume failures.
    - hookutils.py: Add attach_upstart_logs(), thanks Steve Langasek.
    - hookutils.py, in_session_of_problem(): Port from ConsoleKit to logind.
    - apport/report.py: Handle the case where the user has been removed from
      the system, but one of its still-running binaries crashes (LP: #1163453).
    - Fix anonymization of user/GECOS fields with regexp control characters
      like '+'. (LP: #985049)
    - Run tests under LC_CTYPE=C and unset LANG as well, to discover
      assumptions about UTF-8 locales. Fix the two failing tests.
    - Fix UnicodeDecodeError when apport encounters non-ASCII environment
      variables. (LP: #1172638)
  * debian/control: Update Vcs-* for saucy branch.
  * data/general-hooks/cloud_archive.py: Fix PEP-8 error.

  [ Steve Langasek ]
  * data/general-hooks/ubuntu.py: Call attach_upstart_logs(), to attach the
    logs for any upstart user jobs shipped by the binary package.
 -- Martin Pitt <email address hidden> Tue, 30 Apr 2013 14:49:42 -0700

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