broken apport hook: TypeError: Can't convert 'bytes' object to str implicitly

Bug #1582992 reported by Seth Arnold
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Expired
Undecided
Unassigned
libvirt (Ubuntu)
Invalid
High
Unassigned

Bug Description

The apport hooks appear broken:

# ubuntu-bug libvirt-bin
/usr/share/apport/apport-gtk:16: PyGIWarning: Wnck was imported without specifying a version first. Use gi.require_version('Wnck', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import GLib, Wnck, GdkX11, Gdk
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
ERROR: hook /usr/share/apport/package-hooks/source_libvirt.py crashed:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport/report.py", line 197, in _run_hook
    symb['add_info'](report, ui)
TypeError: add_info() takes 1 positional argument but 2 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport/report.py", line 202, in _run_hook
    symb['add_info'](report)
  File "/usr/share/apport/package-hooks/source_libvirt.py", line 21, in add_info
    'libvirt-.*'])
  File "/usr/lib/python3/dist-packages/apport/hookutils.py", line 716, in attach_mac_events
    for match in re.findall(aa_re, report.get('KernLog', '') + report.get('AuditLog', '')):
TypeError: Can't convert 'bytes' object to str implicitly

Don't worry about the Wnck thing, that's bug 1580412.

Thanks

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: libvirt-bin 1.3.1-1ubuntu10
ProcVersionSignature: Ubuntu 4.4.0-21.37-generic 4.4.6
Uname: Linux 4.4.0-21-generic x86_64
NonfreeKernelModules: zfs zunicode zcommon znvpair zavl
ApportVersion: 2.20.1-0ubuntu2
Architecture: amd64
Date: Tue May 17 22:02:30 2016
InstallationDate: Installed on 2012-10-18 (1307 days ago)
InstallationMedia: Ubuntu 12.04.1 LTS "Precise Pangolin" - Release amd64 (20120823.1)
ProcEnviron:
 LANGUAGE=en_US
 TERM=rxvt-unicode
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: libvirt
UpgradeStatus: Upgraded to xenial on 2016-04-30 (17 days ago)
modified.conffile..etc.libvirt.qemu.networks.default.xml: [modified]
mtime.conffile..etc.libvirt.qemu.networks.default.xml: 2016-04-30T00:20:19.958268

Revision history for this message
Seth Arnold (seth-arnold) wrote :
Changed in libvirt (Ubuntu):
status: New → Triaged
importance: Undecided → High
Chris J Arges (arges)
Changed in libvirt (Ubuntu):
assignee: nobody → Chris J Arges (arges)
Revision history for this message
Chris J Arges (arges) wrote :

This works for me in 16.04. Can you update and re-try?

Changed in libvirt (Ubuntu):
status: Triaged → Incomplete
Revision history for this message
Seth Arnold (seth-arnold) wrote :

Chris, still broken, I filed bug 1583362 to test and it's still reporting this error.

# dpkg -l 'apport*' 'libvirt*' | awk '/^ii/ {print $1, $2, "\t", $3}'
ii apport 2.20.1-0ubuntu2
ii apport-gtk 2.20.1-0ubuntu2
ii apport-symptoms 0.20
ii libvirt-bin 1.3.1-1ubuntu10
ii libvirt-glib-1.0-0:amd64 0.2.2-0.1ubuntu1
ii libvirt0:amd64 1.3.1-1ubuntu10

Thanks

Changed in libvirt (Ubuntu):
status: Incomplete → New
Revision history for this message
Chris J Arges (arges) wrote :

So I can't really reproduce this, but looking at the backtrace it seems like more pythong2->python3 troubles:

Could you try modifying the following file:
/usr/lib/python3/dist-packages/apport/hookutils.py

Change line 716 to the following:

    for match in re.findall(aa_re, report.get('KernLog', '').decode('utf-8') + report.get('AuditLog', '').decode('utf-8')):

This is completely untested, but if it solves the issue I think the fix is in apport instead of the libvirt apport hook.

Changed in libvirt (Ubuntu):
status: New → In Progress
Chris J Arges (arges)
Changed in libvirt (Ubuntu):
assignee: Chris J Arges (arges) → nobody
Changed in libvirt (Ubuntu):
status: In Progress → Triaged
tags: added: apport-hook-error
Revision history for this message
Brian Murray (brian-murray) wrote :

Here's a test case that should be easily reproducible using the data in this bug. Use download-crash from the bugpatterns bzr branch to create a crash file for this report e.g. ./download-crash 1582992. Then run the following in python:

 $ python3
Python 3.5.2+ (default, Sep 22 2016, 12:18:14)
[GCC 6.2.0 20160927] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import apport
>>> report = apport.Report()
>>> f = open('report-1582992.crash', 'rb')
>>> report.load(f)
>>> from apport import hookutils
>>> hookutils.attach_mac_events(report, ['/usr/lib/libvirt/virt-aa-helper', '/usr/bin/libvirtd', 'libvirt-.*'])

This did not crash for me on yakkety.

Revision history for this message
Brian Murray (brian-murray) wrote :

It also did not crash for me on Xenial.

(xenial-amd64)root@impulse:/home/bdmurray/source-trees/bugpatterns/master# python3
Python 3.5.2 (default, Nov 17 2016, 17:05:23)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import apport
>>> report = apport.Report()
>>> f = open('report-1582992.crash', 'rb')
>>> report.load(f)
>>> from apport import hookutils
>>> hookutils.attach_mac_events(report, ['/usr/lib/libvirt/virt-aa-helper', '/usr/bin/libvirtd', 'libvirt-.*'])
>>>
(xenial-amd64)root@impulse:/home/bdmurray/source-trees/bugpatterns/master# apt-cache policy apport
apport:
  Installed: 2.20.1-0ubuntu2.5

Changed in apport (Ubuntu):
status: New → Incomplete
Changed in libvirt (Ubuntu):
status: Triaged → Invalid
Revision history for this message
Seth Arnold (seth-arnold) wrote :

This may have been fixed in the interim; I cannot recreate the crash. Even adding a ÿ char (generated via printf '\xff' in a line directly to my /var/log/kern.log didn't trip this.

The python3 hookutils.attach_mac_events() attempt from comments #5 and #6 also didn't recreate the crash.

Thanks

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for apport (Ubuntu) because there has been no activity for 60 days.]

Changed in apport (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.