ctypes broken on armhf

Bug #898172 reported by Loïc Minier
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Python
New
Unknown
python2.6 (Ubuntu)
Won't Fix
Undecided
Unassigned
python2.7 (Ubuntu)
Fix Released
Undecided
Unassigned
python3.2 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Hi

Python's ctypes allows dynamically loading libraries. On linux, it parses ldconfig -p output for a given library name, skipping over incompatible ABIs. ABI is derived from uname output, which is incorrect. Currently, the code can't cope with "hard-float" in the ldconfig -p output on armhf.

I will attach a debdiff which allows ctypes to work on either armel or armhf, but wont work on a biarch or multiarch armel + armhf system.

The code should be redesigned to check the real ABI, not the uname output; one option to do so is to check the ABI of the currently running executable, e.g. ldd on sys.executable as done elsewhere in the script, but still seems fragile; another option is to look at /proc/$pid/maps (probably not portable); another option is to ask libc to do the loading (seems the safest).

Cheers,

Tags: patch
Revision history for this message
Loïc Minier (lool) wrote :
tags: added: patch
Revision history for this message
Matthias Klose (doko) wrote :

won't fix for python2.6, to be removed

Changed in python2.6 (Ubuntu):
status: New → Won't Fix
Revision history for this message
Dr. David Alan Gilbert (davidgil-uk) wrote :

Beware that ctypes may be broken in other ways on armhf as well; in particular it uses libffi to do its binding and a while ago when I looked I came to the conclusion it probably won't call variadic functions correctly if they are passed FP values.

My post to the ctypes list:
http://permalink.gmane.org/gmane.comp.python.ctypes/4657

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python2.7 - 2.7.2-8

---------------
python2.7 (2.7.2-8) unstable; urgency=low

  * Update to 20111130, taken from the 2.7 branch.
  * New patch, ctypes-arm, allow for ",hard-float" after libc6 in ldconfig -p
    output (Loic Minier). LP: #898172.
  * debian/rules: Define DPKG_VARS (Alban Browaeys). Closes: #647419).
  * Add python-config man page (Johann Felix Soden). Closes: #650181).

python2.7 (2.7.2-7) unstable; urgency=low

  * Adjust patches for removed Lib/plat-linux3.
  * Add build conflict to libncurses5-dev, let configure search for
    ncurses headers in /usr/include/ncursesw too.

python2.7 (2.7.2-6) unstable; urgency=low

  * Update to 20111004, taken from the 2.7 branch.
  * Use the ncursesw include directory when linking with ncursesw.
  * Rebuild with libreadline not linked with libncurses*. Closes: #643816.
  * Fix typos in the multiprocessing module. Closes: #643856.
 -- Matthias Klose <email address hidden> Thu, 01 Dec 2011 12:40:07 +0000

Changed in python2.7 (Ubuntu):
status: New → Fix Released
Changed in python:
status: Unknown → New
Revision history for this message
Matthias Klose (doko) wrote :

fixed in python3.2 3.2.2-1

Changed in python3.2 (Ubuntu):
status: New → 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.