Ubuntu

Unnecessary imports to work out apport reporting is disabled

Reported by Stuart Colville on 2010-02-26
94
This bug affects 16 people
Affects Status Importance Assigned to Milestone
Apport
Low
Unassigned
apport (Ubuntu)
Low
Martin Pitt
Declined for Karmic by Martin Pitt
Lucid
Low
Martin Pitt

Bug Description

Binary package hint: apport

This post http://rhodesmill.org/brandon/2010/ubuntu-exception-190-modules/ demonstrates a bug in the way apport settings are checked.

To demonstrate the problem:

>>> import sys
>>> len(sys.modules)
34
>>> foo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'foo' is not defined
>>> len(sys.modules)
215
>>>

This is because the apport_python_hook.py imports from apport to use the enabled method that checks /etc/default/apport

The solution is to move the check of /etc/default/apport into the hook which results in the following:

Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> len(sys.modules)
39
>>> foo
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'foo' is not defined
>>> len(sys.modules)
39

Wow, crazy. Good find.

Chad Miller (cmiller) on 2010-02-26
Changed in apport (Ubuntu):
status: New → Confirmed
Changed in apport:
status: New → Confirmed
Changed in apport (Ubuntu):
importance: Undecided → Medium
Jim J (morlockhq) wrote :

Confirmed. Please backport this fix to at least 9.10 if possible. A lot of us aren't in a situation that we can upgrade to the newest Ubuntu just to fix problems like this if the fix is only released in the next version of the distribution.

tags: added: patch
Martin Pitt (pitti) wrote :
Changed in apport:
status: Confirmed → Fix Released
importance: Undecided → Low
Changed in apport (Ubuntu):
importance: Medium → Low
status: Confirmed → Fix Committed
assignee: nobody → Martin Pitt (pitti)
Launchpad Janitor (janitor) wrote :

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

---------------
apport (1.13-0ubuntu1) lucid; urgency=low

  * New upstream release:
    - Add "unkillable_shutdown" script to collect information about processes
      which are still running after sending SIGTERM to them. This can be
      hooked into e. g. /etc/init.d/sendsigs on Debian/Ubuntu systems.
    - apport_python_hook.py: Directly check /etc/default/apport instead of
      querying packaging.enabled(), to avoid importing lots of modules for
      non-packaged scripts. Thanks Stuart Colville! (LP: #528355)
    - Fix SegV parser to notice walking off the stack during "call" or "ret"
      (LP: #531672).
    - Fix --help output for bug updating mode (invocation as apport-collect or
      apport-update-bug). (LP: #504116)
    - Fix bug escalation tagging, thanks to Brian Murray.
    - Fix option processing when being invoked as apport-bug. Thanks to Daniel
      Hahler for the patch! (LP: #532944)
  * debian/apport.install: Install unkillable_shutdown.
 -- Martin Pitt <email address hidden> Thu, 11 Mar 2010 08:42:05 +0100

Changed in apport (Ubuntu Lucid):
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