[issue19317] ctypes.util.find_library should examine binary's RPATH on Solaris

Maciej Bliziński report at bugs.python.org
Tue Oct 22 09:52:39 CEST 2013


Maciej Bliziński added the comment:

The specific case that breaks for me is this:

OpeCSW Python package includes:

/opt/csw/bin/python2.6 (also 2.7, 3.3, etc)
/opt/csw/lib/libpython2.6.so.1.0
(other files)

On the operating system there is only:
/usr/lib/libpython2.4.so.1.0

Let's say there's libmagic installed in /opt/csw/lib, and there's no libmagic in /usr/lib. Let's suppose you run this:

ctypes.cdll.LoadLibrary('libmagic.so.1')

The OpenCSW Python will successfully load libmagic.so.1. But without the patch, find_library will not find libmagic.so.1, it will fail to translate 'magic' to 'libmagic.so.1', even though the libmagic.so symlink is present in /opt/csw/lib.

For the patch, the RPATH of the library itself doesn't matter, the important one is the RPATH of the Python executable itself, which influences what _ctypes.dlopen() does when looking for a library.

I could write a test by providing providing a sample /usr/ccs/bin/dump output and mocking out some libraries. Would that be good?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19317>
_______________________________________


More information about the Python-bugs-list mailing list