Unnecessary imports to work out apport reporting is disabled

Bug #528355 reported by Stuart Colville
94
This bug affects 16 people
Affects Status Importance Assigned to Milestone
Apport
Fix Released
Low
Unassigned
apport (Ubuntu)
Fix Released
Low
Martin Pitt
Declined for Karmic by Martin Pitt
Lucid
Fix Released
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

Tags: patch
Revision history for this message
Stuart Colville (muffinresearch) wrote :
Revision history for this message
Carlos Andrés Rocha (carlos-rocha) wrote :

Wow, crazy. Good find.

Chad Miller (cmiller)
Changed in apport (Ubuntu):
status: New → Confirmed
Changed in apport:
status: New → Confirmed
Changed in apport (Ubuntu):
importance: Undecided → Medium
Revision history for this message
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
Revision history for this message
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)
Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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