[Bug 1579897] Re: report's _command_output function doesn't always return the error

Martin Pitt martin.pitt at ubuntu.com
Wed May 11 09:21:54 UTC 2016

Reproduced with "sudo dpkg --force-all -P libbabeltrace1" which breaks
gdb (but keeps python3.5 intact).

Fixed in http://bazaar.launchpad.net/~apport-

** Changed in: apport
       Status: In Progress => Fix Released

** Also affects: apport (Ubuntu)
   Importance: Undecided
       Status: New

** Changed in: apport (Ubuntu)
   Importance: Undecided => Low

** Changed in: apport (Ubuntu)
       Status: New => Fix Committed

You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to apport in Ubuntu.

  report's _command_output function doesn't always return the error

Status in Apport:
  Fix Released
Status in apport package in Ubuntu:
  Fix Committed

Bug description:
  Apparently, the following gdb command fails but the error output is
  not in subprocess's err output but in stdout.

  > /srv/daisy.staging.ubuntu.com/staging/apport-2984/apport/report.py(104)_command_output()
  -> if sp.returncode == 0:
  (Pdb) l
   99         '''
  100         sp = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=stderr)
  102         (out, err) = sp.communicate(input)
  103         import pdb; pdb.set_trace()
  104  ->     if sp.returncode == 0:
  105             return out
  106         else:
  107             if err:
  108                 err = err.decode('UTF-8', errors='replace')
  109             else:
  (Pdb) command
  ['/tmp/apport_sandbox__6uwrvhm/usr/bin/gdb', '--ex', 'set debug-file-directory /tmp/apport_sandbox__6uwrvhm/usr/lib/debug', '--ex', 'set solib-absolute-prefix /tmp/apport_sandbox__6uwrvhm', '--ex', 'file "/tmp/apport_sandbox__6uwrvhm//usr/bin/cdparanoia"', '--ex', 'core-file /tmp/apport_core_756rypvb', '--batch', '--ex', 'set backtrace limit 2000', '--ex', 'p -99', '--ex', 'print (char*) __nih_abort_msg', '--ex', 'p -99', '--ex', 'print __abort_msg->msg', '--ex', 'p -99', '--ex', 'print __glib_assert_msg', '--ex', 'p -99', '--ex', 'bt full', '--ex', 'p -99', '--ex', 'x/16i $pc', '--ex', 'p -99', '--ex', 'thread apply all bt full', '--ex', 'p -99', '--ex', 'info registers']
  (Pdb) out
  b'/tmp/apport_sandbox__6uwrvhm/usr/bin/gdb: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory\n'

  Because stdout is not included in the raised error message it ended up
  being hard to find out what the error really was.

  111             raise OSError('Error: command %s failed with exit code %i: %s' % (
  112                 str(command), sp.returncode, err))

To manage notifications about this bug go to:

More information about the foundations-bugs mailing list