apport hooks included in python2.4, but code only works with 2.5

Bug #107662 reported by Stuart Bishop
6
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Fix Released
High
Martin Pitt
Feisty
Fix Released
High
Martin Pitt
Gutsy
Fix Released
High
Martin Pitt

Bug Description

Binary package hint: apport

/var/lib/python-support/python2.4/apport/report.py imports ctypes, but this is not available with Python2.4 in Feisty. This breaks things:

16:44:17~/lp/trivial/lib/canonical/database/ftests $ PYTHONPATH=/home/stub/lp/trivial/lib python2.4 script_isolation.py

read committed
read committed
read committed
serializable
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/home/stub/lp/trivial/lib/sqlobject/dbconnection.py", line 27, in _closeConnection
    conn.close()
  File "/home/stub/lp/trivial/lib/sqlobject/dbconnection.py", line 780, in close
    except self.module.Error:
AttributeError: 'PostgresAdapter' object has no attribute 'module'
Error in sys.exitfunc:
Error in sys.excepthook:
Traceback (most recent call last):
  File "/var/lib/python-support/python2.4/apport_python_hook.py", line 30, in apport_excepthook
    import apport.report, apport.fileutils
  File "/var/lib/python-support/python2.4/apport/__init__.py", line 1, in ?
    from apport.report import Report
  File "/var/lib/python-support/python2.4/apport/report.py", line 15, in ?
    import ctypes, ctypes.util, fnmatch
ImportError: No module named ctypes

Original exception was:
Traceback (most recent call last):
  File "/usr/lib/python2.4/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/home/stub/lp/trivial/lib/sqlobject/dbconnection.py", line 27, in _closeConnection
    conn.close()
  File "/home/stub/lp/trivial/lib/sqlobject/dbconnection.py", line 780, in close
    except self.module.Error:
AttributeError: 'PostgresAdapter' object has no attribute 'module'

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks for the report. This needs to be fixed along with bug 107662 in a Feisty SRU.

Changed in apport:
assignee: nobody → pitti
importance: Undecided → High
status: Unconfirmed → In Progress
Revision history for this message
Dan O'Huiginn (daniel-ohuiginn) wrote :

Martin, this *is* bug 107662!

>Thanks for the report. This needs to be fixed along with bug 107662 in a Feisty SRU.

Revision history for this message
Martin Pitt (pitti) wrote :

Dan, oops, sorry. Of course I meant bug 104864.

Revision history for this message
Martin Pitt (pitti) wrote :
Changed in apport:
status: In Progress → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote :

For the SRU reviewers, this is a simple test:

Current Feisty (without python-ctypes installed):

$ python2.4 -c 'assert False'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/var/lib/python-support/python2.4/apport_python_hook.py", line 30, in apport_excepthook
    import apport.report, apport.fileutils
  File "/var/lib/python-support/python2.4/apport/__init__.py", line 1, in ?
    from apport.report import Report
  File "/var/lib/python-support/python2.4/apport/report.py", line 15, in ?
    import ctypes, ctypes.util, fnmatch
ImportError: No module named ctypes

With SRU package:

$ python2.4 -c 'assert False'
Traceback (most recent call last):
  File "<string>", line 1, in ?
AssertionError

Revision history for this message
Martin Pitt (pitti) wrote :

Uploaded to feisty-proposed:

 apport (0.76.1~prop1) feisty-proposed; urgency=low
 .
   Fix breakage with all applications that use Python 2.4:
 .
   * apport/report.py: Replace any() call with a list comprehension to work
     with Python < 2.5. (LP: #104864)
   * apport/report.py: Move the ctypes import to the one place where we
     actually need it, and do not entirely fail if they do not exist (such as
     in Python 2.4). It is only required for non-default Feisty kernels anyway.
     (LP: #107662)

Acceptance is pending the proper gutsy changes for Soyuz, currently the publisher is broken.

Changed in apport:
status: Fix Committed → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

Accepted into feisty-proposed.

Changed in apport:
status: In Progress → Fix Committed
Revision history for this message
Michael Vogt (mvo) wrote :

I verified this usind the test in comment 5 (thanks for providing it!) and it works as expected.

Revision history for this message
Martin Pitt (pitti) wrote :

 apport (0.77) gutsy; urgency=low
 .
   * apport/report.py: Replace any() call with a list comprehension to work
     with Python < 2.5. (LP: #104864)
   * apport/report.py: Move the ctypes import to the one place where we
     actually need it, and do not entirely fail if they do not exist (such as
     in Python 2.4). It is only required for non-default Feisty kernels anyway.
     (LP: #107662)
   * apport/chroot.py: Fix test suite to work with Python 2.4's tarfile module
     output format.
   * debian/local/setup-apport-retracer: Generalized some feisty specific
     bits, set default release to gutsy.

Changed in apport:
status: Fix Committed → Fix Released
Revision history for this message
Martin Pitt (pitti) wrote :

Accepted into feisty-updates.

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