ubuntu general hook assumes reports have a ProblemType field

Bug #1004029 reported by Brian Murray on 2012-05-24
22
This bug affects 2 people
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Low
Martin Pitt
Precise
Low
Unassigned
linux (Ubuntu)
Low
Unassigned
Precise
Undecided
Unassigned

Bug Description

My coworker Joe said
apport-collect is not workin'
I slapped my hand against my head
lets find where that bug is lurkin'

FIX: http://bazaar.launchpad.net/~ubuntu-core-dev/ubuntu/precise/apport/ubuntu/revision/1961

SRU TEST CASE:
- Subscribe to this bug (or pick any other bug against linux)
- Run "apport-collect -p linux 1004029"
- With current precise version, you get a backtrace like in comment 20; with the -proposed version that should be gone.

REGRESSION POTENTIAL: Negligible, just replaces a direct dictionary access with a .get() variant; if the ubuntu.py hook should be broken further on, and it crashes, that still won't stop apport from reporting the bug.

This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:

apport-collect 1004029

and then change the status of the bug to 'Confirmed'.

If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.

This change has been made by an automated script, maintained by the Ubuntu Kernel Team.

Changed in linux (Ubuntu):
status: New → Incomplete

AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.24.
ApportVersion: 2.0.1-0ubuntu7
Architecture: amd64
ArecordDevices:
 **** List of CAPTURE Hardware Devices ****
 card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]
   Subdevices: 0/1
   Subdevice #0: subdevice #0
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC0: jsalisbury 2597 F.... pulseaudio
 /dev/snd/pcmC0D0c: jsalisbury 2597 F...m pulseaudio
 /dev/snd/pcmC0D0p: jsalisbury 2597 F...m pulseaudio
CRDA: Error: [Errno 2] No such file or directory
Card0.Amixer.info:
 Card hw:0 'Intel'/'HDA Intel at 0xf2520000 irq 45'
   Mixer name : 'Intel IbexPeak HDMI'
   Components : 'HDA:14f15069,17aa2155,00100302 HDA:80862804,17aa21b5,00100000'
   Controls : 14
   Simple ctrls : 6
Card29.Amixer.info:
 Card hw:29 'ThinkPadEC'/'ThinkPad Console Audio Control at EC reg 0x30, fw 6QHT33WW-1.14'
   Mixer name : 'ThinkPad EC 6QHT33WW-1.14'
   Components : ''
   Controls : 1
   Simple ctrls : 1
Card29.Amixer.values:
 Simple mixer control 'Console',0
   Capabilities: pswitch pswitch-joined penum
   Playback channels: Mono
   Mono: Playback [on]
DistroRelease: Ubuntu 12.04
EcryptfsInUse: Yes
HibernationDevice: RESUME=UUID=1faf7c10-b9c3-42b7-89fa-24d0ed1b6298
InstallationMedia: Ubuntu 10.04.1 LTS "Lucid Lynx" - Release amd64 (20100816.1)
IwConfig: Error: [Errno 2] No such file or directory
MachineType: LENOVO 3249CTO
Package: linux 3.2.0.24.26
PackageArchitecture: amd64
ProcEnviron:
 LANGUAGE=en_US:en
 TERM=xterm
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
ProcFB: 0 inteldrmfb
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.2.0-24-generic root=UUID=3c5128b9-06cf-46f5-ba3b-6e44ccc995ff ro quiet splash i915.i915_enable_fbc=1 drm.vblankoffdelay=1 vt.handoff=7
ProcVersionSignature: Ubuntu 3.2.0-24.38-generic 3.2.16
RelatedPackageVersions:
 linux-restricted-modules-3.2.0-24-generic N/A
 linux-backports-modules-3.2.0-24-generic N/A
 linux-firmware 1.79
RfKill: Error: [Errno 2] No such file or directory
StagingDrivers: mei
Tags: precise staging
UdevDb: Error: [Errno 2] No such file or directory
Uname: Linux 3.2.0-24-generic x86_64
UnreportableReason: This is not an official Ubuntu package. Please remove any third party package and try again.
UpgradeStatus: Upgraded to precise on 2011-12-12 (164 days ago)
UserGroups: adm admin cdrom dialout kvm libvirtd lpadmin plugdev sambashare
WifiSyslog:

dmi.bios.date: 12/01/2011
dmi.bios.vendor: LENOVO
dmi.bios.version: 6QET68WW (1.38 )
dmi.board.name: 3249CTO
dmi.board.vendor: LENOVO
dmi.board.version: Not Available
dmi.chassis.asset.tag: No Asset Information
dmi.chassis.type: 10
dmi.chassis.vendor: LENOVO
dmi.chassis.version: Not Available
dmi.modalias: dmi:bvnLENOVO:bvr6QET68WW(1.38):bd12/01/2011:svnLENOVO:pn3249CTO:pvrThinkPadX201:rvnLENOVO:rn3249CTO:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable:
dmi.product.name: 3249CTO
dmi.product.version: ThinkPad X201
dmi.sys.vendor: LENOVO

tags: added: apport-collected precise staging

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

apport information

Changed in linux (Ubuntu):
importance: Undecided → Low

I'm only able to recreate this on one of my precise systems. The traceback follows:

ERROR: hook /usr/share/apport/general-hooks/ubuntu.py crashed:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/apport/report.py", line 718, in add_hooks_info
    symb['add_info'](self, ui)
  File "/usr/share/apport/general-hooks/ubuntu.py", line 45, in add_info
    match_error_messages(report)
  File "/usr/share/apport/general-hooks/ubuntu.py", line 129, in match_error_messages
    if report['ProblemType'] == 'Package':
  File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'ProblemType'
Traceback (most recent call last):
  File "/usr/share/apport/apport-gtk", line 499, in <lambda>
    GLib.idle_add(lambda: self.collect_info(on_finished=self.ui_update_view))
  File "/usr/lib/python2.7/dist-packages/apport/ui.py", line 867, in collect_info
    icthread.exc_raise()
  File "/usr/lib/python2.7/dist-packages/apport/REThread.py", line 34, in run
    self._retval = self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.7/dist-packages/apport/ui.py", line 111, in thread_collect_info
    if report['ProblemType'] == 'Crash' and \
  File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'ProblemType'

This looks like bug 947519 but that was fixed quite some time ago.

Changed in apport (Ubuntu):
status: New → Triaged
importance: Undecided → High
Changed in apport (Ubuntu Precise):
status: New → Triaged
importance: Undecided → High
Brian Murray (brian-murray) wrote :

Now that this has an apport task it doesn't happen by default anymore e.g. 'apport-collect -p apport 1004029' works but 'apport-collect -p linux 1004029' fails.

Brian Murray (brian-murray) wrote :

add_info in the ubuntu.py general hook is called two times and the 2nd time ProblemType is not set:

 $ apport-collect -p linux 1004029
> /usr/share/apport/general-hooks/ubuntu.py(35)add_info()
     34 import ipdb; ipdb.set_trace()
---> 35 if report.get('ProblemType') == 'Package':
     36 check_for_disk_error(report)

ipdb> report.get('ProblemType')
'Bug'
ipdb> continue
No packages found matching linux.
> /usr/share/apport/general-hooks/ubuntu.py(35)add_info()
     34 import ipdb; ipdb.set_trace()
---> 35 if report.get('ProblemType') == 'Package':
     36 check_for_disk_error(report)

ipdb> report.get('ProblemType')

Brian Murray (brian-murray) wrote :

This also works much better, e.g. apport doesn't crash, so it must be something with the look up of unknown packages.

apport-collect -p linux-image-3.2.0-24-generic 1004029

Changed in apport (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
summary: - test bug report for using apport-collect
+ apport-collect does not work for bugs with a linux task
summary: - apport-collect does not work for bugs with a linux task
+ apport-collect does not work for bugs with only a linux task

Ultimately this is bug 359810, as there really is no binary package called "linux". However, it should not crash like that, and instead just collect the info from the source package hook (and skip all the binary packages). That's the regression in precise, which is a dupe of bug 993810.

Martin Pitt (pitti) wrote :

While the hang/crash of the UI is bug 993810 and will be handled there, I unduplicate this to use this for this crash:

ERROR: hook /usr/share/apport/general-hooks/ubuntu.py crashed:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/apport/report.py", line 718, in add_hooks_info
    symb['add_info'](self, ui)
  File "/usr/share/apport/general-hooks/ubuntu.py", line 45, in add_info
    match_error_messages(report)
  File "/usr/share/apport/general-hooks/ubuntu.py", line 129, in match_error_messages
    if report['ProblemType'] == 'Package':
  File "/usr/lib/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'ProblemType'

This should be fixed in the ubuntu hook.

summary: - apport-collect does not work for bugs with only a linux task
+ ubuntu general hook assumes reports have a ProblemType field
Changed in apport (Ubuntu):
importance: High → Medium
Changed in apport (Ubuntu Precise):
importance: High → Medium
Changed in apport (Ubuntu):
status: Triaged → Fix Committed
Martin Pitt (pitti) wrote :

Not an important SRU. With the proper fix for bug 993810 this bug won't be exposed.

Changed in apport (Ubuntu):
importance: Medium → Low
Changed in apport (Ubuntu Precise):
status: Triaged → Won't Fix
Changed in linux (Ubuntu Precise):
status: New → Invalid
Changed in linux (Ubuntu):
status: Incomplete → Invalid
Martin Pitt (pitti) wrote :

Ah, I already have it in the precise branch, so let's include it then.

Changed in apport (Ubuntu Precise):
status: Won't Fix → Fix Committed
importance: Medium → Low
Launchpad Janitor (janitor) wrote :

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

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

  [ Martin Pitt ]
  * debian/control: Update Vcs-Bzr: for quantal branch.
  * data/general-hooks/ubuntu.py: Do not assume that all reports have a
    ProblemType field. This will not be the case for updating a bug with
    "apport-collect". (LP: #1004029)
  * New upstream release:
    - launchpad.py: When closing a bug as a duplicate, copy some well-known
      tags to the master bug. Thanks Brian Murray.
    - launchpad.py: Set importance of Python crash reports to "Medium" by
      default, similar to signal crashes. Thanks Brian Murray.
    - hookutils.py: Add attach_default_grub() convenience function from the
      grub2 package hook so it can be used by other packages. Thanks Brian
      Murray.
    - launchpad.py: Make Launchpad bug subscription user/team configurable:
      The initial subscriber after filing a bug can be set with the
      "initial_subscriber" crashdb option, and the team which gets subscribed
      after retracing with "triaging_team". (LP: #980726)
    - report.py: Do not change the SourcePackage: field if the binary package
      is not installed and does not exist. This fixes source package hooks to
      actually work in some cases where source and binary package names
      overlap. (part of LP: #993810)
    - apport-gtk, apport-kde: Avoid collecting information twice in "bug
      update" mode. This caused a crash in cases where the source package in a
      bug report does not correspond to an installed binary package.
      (LP: #993810)

  [ Brian Murray ]
  * data/general-hooks/ubuntu.py: block reporting of package install failures
    with error regarding 'not a debian format archive'
 -- Martin Pitt <email address hidden> Wed, 30 May 2012 09:06:49 +0200

Changed in apport (Ubuntu):
status: Fix Committed → Fix Released
Clint Byrum (clint-fewbar) wrote :

Hi! This bug needs a test case and regression potential before we can accept it into precise-proposed.

Martin Pitt (pitti) on 2012-06-01
description: updated
description: updated

Hello Brian, or anyone else affected,

Accepted apport into precise-proposed. The package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Stéphane Graber (stgraber) wrote :

No more crash with the SRU.

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

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

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

  * data/package-hooks/source_linux.py: If we report against an -lts-quantal
    source package, move the source to "linux" and add a qa-kernel-lts-testing
    tag, as per kernel team request in LP: #1004101 . Add source package hook
    symlinks for source_linux-{,meta-}lts-quantal.py to source_linux.py.
  * data/apport: apport: Also treat a binary as modified if the /proc/pid/exe
    symlink does not point to an existing file any more. Backported from trunk
    r2406. (LP: #984944)

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

  * debian/apport.install: Actually ship the native-origins.d directory, so
    that the previous bug fix for LP: #1004101 actually works.

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

  [ Martin Pitt ]
  * data/apport: Ignore a crash if the executable was modified after the
    process started. This often happens if the package is upgraded and a
    long-running process is not stopped before. Patch cherry-picked from trunk
    r2296. (LP: #984944)
  * Add etc/apport/native-origins.d/lts-q-backports: Accept
    ppa:ubuntu-x-swat/q-lts-backport as official Ubuntu package repository, so
    that users can report bugs and crashes against the backported kernel and
    X.org stack. (LP: #1004101)
  * data/general-hooks/ubuntu.py: Do not assume that all reports have a
    ProblemType field. This will not be the case for updating a bug with
    "apport-collect". (LP: #1004029)
  * report.py: Do not change the SourcePackage: field if the binary package is
    not installed and does not exist. This fixes source package hooks to
    actually work in some cases where source and binary package names overlap.
    Patch cherry-picked from trunk r2332. (part of LP: #993810)
  * apport-gtk, apport-kde: Avoid collecting information twice in "bug update"
    mode. This caused a crash in cases where the source package in a bug
    report does not correspond to an installed binary package. Patch
    cherry-picked from trunk r2334. (LP: #993810)

  [ Brian Murray ]
  * data/general-hooks/ubuntu.py: block reporting of package install failures
    with error regarding 'not a debian format archive'. (LP: #1002535)
 -- Martin Pitt <email address hidden> Thu, 28 Jun 2012 09:01:41 +0200

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.

Other bug subscribers