doesn't check to see if apport is enabled

Bug #222260 reported by Brian Murray on 2008-04-26
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Martin Pitt
Martin Pitt

Bug Description

Binary package hint: apport

1) Hardy Heron
2) Installed: 0.108
3) python crashes not to show up in Launchpad for Hardy Heron any more
4) I found bug 222217

The changelog for apport 0.108 states:
  * debian/apport.default: Disable Apport for the final Hardy release, since
    it is less useful in stable releases, and drains a lot of CPU and I/O
    power on crashes. Disabling it here instead of in update-notifier/adept is
    more discoverable and more centralized.

However, doesn't check that file before reporting bugs so python crashes continue to be reported.

  1. Introduce a bug into a Python program (or find an existing crash):

    sudo sed -i '2 s/^/assert False/' /usr/bin/lsb_release

  2. Run "lsb_release" in a Terminal.

With current Hardy you will get an Apport crash notification. With the hardy-proposed version, you will not get any more if /etc/default/apport disabled apport. If you enable it again, you should get an Apport notification again.

  3. Restore lsb_release again:

  sudo sed -i '2 s/^.*$//' /usr/bin/lsb_release

Kees Cook (kees) wrote :

Attaching a branch that fixes this. I note, however, that this is not a very distro-agnostic way to handle it. Perhaps a /var/lib/apport file that /etc/init.d/apport modifies would be "better"?

=== modified file ''
--- 2008-04-11 21:04:30 +0000
+++ 2008-04-26 01:06:30 +0000
@@ -30,6 +30,15 @@
     # import locally here so that there is no routine overhead on python
     # startup time - only when a traceback occurs will this trigger.
+ # test if apport is enabled
+ enabled=1
+ try:
+ execfile('/etc/default/apport')
+ except:
+ pass
+ if not enabled:
+ return
         # ignore 'safe' exit types.
         if exc_type in (KeyboardInterrupt, ):

Kees Cook (kees) wrote :

LP really doesn't like whitespace, does it? :)

Changed in apport:
assignee: nobody → pitti
importance: Undecided → Medium
status: New → Triaged
Martin Pitt (pitti) wrote :

Note to self: Kees' patch clobbers the global namespace, it should use and pass a local/global dictionary.

Martin Pitt (pitti) wrote :

Note 2: use a regular expression match instead of execfile(). This is both technically more correct, and probably also much cheaper.

Changed in apport:
status: Triaged → In Progress

On Sat, Apr 26, 2008 at 08:08:15AM -0000, Martin Pitt wrote:
> Note to self: Kees' patch clobbers the global namespace, it should use
> and pass a local/global dictionary.

Owch, really? I thought it defaulted to only messing with the local
namespace? Anyway, yes, mostly it serves as an example. I was digging
around for where python did the apport hooks and figured I'll cook
something up while I was in there. :)

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 0.110

apport (0.110) intrepid; urgency=low

  * apport/ In the test suite, copy some system binaries/libraries
    into a fakechroot and exercise a lot of standard shell commands (cp, ln
    -s, rm, rm -r, mkdir, echo, chmod, chown, etc.) with absolute/relative
    paths. This reproduces the total breakage of rm'ing, chmod'ing, and
    chown'ing absolute paths in hardy fakechroots.
  * bin/crash-digger: Intercept exceptions when downloading crash reports for
    duplicate checking, so that the retracer does not crash on malformed bug
    reports. (LP: #205178)
  * apport/ Introduce a new function enabled() which reports
    whether Apport should create crash reports. Signal crashes are controlled
    by /proc/sys/kernel/core_pattern, but we need that to control whether
    reports for Python, package, or kernel crashes are generated.
  * backends/ Provide implementation for
    PackageInfo.enabled() for Debian/Ubuntu by evaluating /etc/default/apport.
    Add various test cases for different configuration files and absent files.
  * Do not create reports if Apport is disabled (in
    /etc/default/apport). (LP: #222260)

 -- Martin Pitt <email address hidden> Sat, 17 May 2008 12:44:21 +0200

Changed in apport:
status: In Progress → Fix Released
Martin Pitt (pitti) wrote :

For Hardy we need to cherrypick those two revisions from trunk:
     provide the infrastructure for reading /etc/default/apport in a reaonable upstream-compatible manner
     use the new enable() function from above to suppress reports for Python

Martin Pitt (pitti) wrote :

I backported above two changes to the hardy branch: . Apart from those, I changed debian/control to have Vcs-Bzr: point to the hardy branch. I uploaded the package to hardy-proposed, awaiting ack from Steve now.

Martin Pitt (pitti) on 2008-05-17
description: updated
Steve Langasek (vorlon) wrote :

Accepted into -proposed, please test and give feedback here

Changed in apport:
status: In Progress → Fix Committed
Brian Murray (brian-murray) wrote :

On Hardy with apport package version 0.108.1 I caused a python application to crash and observed an apport crash notification. After installing python-apport and apport version 0.108.2 I no longer observed an apport crash notification. Additionally, after enabling crash reports in /etc/default/apport I continued to receive an apport crash notification with 0.108.2.

Martin Pitt (pitti) wrote :

Copied to hardy-updates.

Changed in apport:
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