This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ctypes.util fails to find libc in some environments
Type: Stage:
Components: ctypes Versions: Python 2.5
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: theller Nosy List: doko, exarkun, pitrou, terry.reedy, theller
Priority: normal Keywords: patch

Created on 2008-07-16 18:31 by exarkun, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ctypes-util.patch exarkun, 2008-07-16 18:31
Messages (9)
msg69814 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2008-07-16 18:31
ctypes.util assumes several things of its environment which sometimes
don't hold:

  * It depends on objdump being in $PATH.  If it isn't, it will fail to
read the SONAME from a library, even if it has determined the path to it.
  * If it uses ldconfig (which, unlike objdumb, it assumes it knows the
full path to and doesn't rely on $PATH to find), it fails to interpret
the results because the regular expression it applies doesn't define any
groups.

The attached patch is what I used to work around these issues in one
particular environment.  I don't claim the fixes to be general, and the
patch includes no unit tests.
msg71029 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2008-08-11 18:39
Any chance of getting this fixed?
msg71032 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2008-08-11 19:23
Well, I have no idea what the standard setup on posix boxes is - should
objdump and ldconfig be on $PATH or not?

Regarding the groups in the regexp:  It is my understanding that the
parens do not matter because .group(0) is returned, which contains the
entire matching string anyway - do I overlook something?

Please note that the find_library() code was not written by myself ;-(
msg71087 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-08-13 16:26
> Well, I have no idea what the standard setup on posix boxes is - should
> objdump and ldconfig be on $PATH or not?

I think it should try first in $PATH and, if not found, try in /usr/sbin
afterwards. /usr/sbin isn't always in $PATH when in non-root mode.
msg79419 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2009-01-08 15:47
I think 4861 provides a solution for this issue. I don't see any system
where objdump is in /sbin or /usr/sbin.
msg79427 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2009-01-08 17:17
I think Antoine meant (and I was just copying him) /bin or /usr/bin. 
The specific case where I encountered the failure was one where PATH was
not set to anything.  The fix in the patch attached to this ticket would
make it much easier to track down why the failure happened, but it
wouldn't fix it.  I guess I'd be satisfied with this, but of course I'd
be happier if it actually worked. :)
msg79443 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-01-08 21:22
Well, I did mean /usr/sbin at the time, but I don't remember why I said
that. However, I had access to Solaris and AIX machines back then, and
my comment may be related to finding out where objdump was on those
machines.

(sorry, I have a bad memory)
msg79557 - (view) Author: Matthias Klose (doko) * (Python committer) Date: 2009-01-10 17:23
I keep this open for now, I don't have access to AIX. Yes, if objdump is
found in some /sbin PATH, then maybe we should search there explicitely.
msg108642 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-06-25 22:47
Given the patch applied for #4861, I think this should be closed until someone finds that there is still a bug in a current version of Python and determines that there is something to be done.
History
Date User Action Args
2022-04-11 14:56:36adminsetgithub: 47633
2010-06-25 22:47:52terry.reedysetstatus: open -> closed

nosy: + terry.reedy
messages: + msg108642

resolution: out of date
2009-01-10 17:23:10dokosetmessages: + msg79557
2009-01-08 21:22:35pitrousetmessages: + msg79443
2009-01-08 17:17:37exarkunsetmessages: + msg79427
2009-01-08 15:47:32dokosetnosy: + doko
messages: + msg79419
2008-08-13 16:26:15pitrousetnosy: + pitrou
messages: + msg71087
2008-08-11 19:23:12thellersetmessages: + msg71032
2008-08-11 18:39:35exarkunsetmessages: + msg71029
2008-07-16 18:31:52exarkuncreate