~mgedmin/apport/fix-lp1453011

Viewing all changes in revision 2957.

  • Committer: Marius Gedminas
  • Date: 2015-05-08 08:04:32 UTC
  • Revision ID: marius@gedmin.as-20150508080432-lq8pv6kdgzudifi8
Don't let gdb's stderr interfere with apport's spliting logic

I noticed that _command_output() was used in only one place in the codebase, so
I took the liberty of removing unused arguments and changing the API to return
stdout and strerr separately (and, also, decoded into Unicode).

I don't know if the truncated core file warning shows up in stdout or stderr,
so I made the parser expect it in either.

I also made apport notice when the splitting logic goes wrong and append an

  UnreportableReason: Couldn't split gdb's output correctly (got N parts instead of M)

I didn't make it raise because then there's no chance to see how the splitting
went wrong, and now we can at least find some interesting bits of information
in unrelated fields.

I don't know if UnreportableReason is the right field to use.

I think maybe it would be good to attach any leftover parts (if there are any,
which would happen if gdb happened to print $n = -99 for some reason in the
middle of one of the parts) into a new field, but I couldn't come up with a
name.  Also note that old code would've raised an IndexError: pop from an empty
list in this case, but I changed it to use zip() so now the report will
proceed, ignoring any extra parts.

This ought to fix https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1453011,
but I'm not sure how to test it.

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: