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.

Title: dlopen() error with no error message from dlerror()
Type: crash Stage:
Components: Library (Lib) Versions: Python 2.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: theller Nosy List: theller, vstinner
Priority: normal Keywords: patch

Created on 2008-07-07 13:24 by vstinner, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit
dl_open.patch vstinner, 2008-07-07 13:24 Patch to fix dl_open()
ctypes_dlopen.patch vstinner, 2008-07-08 13:45 Patch to fix _ctypes.dlopen()
Messages (4)
msg69388 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2008-07-07 13:24
Python dl_open() function (from dl module) calls dlopen() and check 
its result: if it's NULL, it's an error. This is correct if I read the 
man page. But with an invalid flag value (-1), dlopen() returns NULL 
but dlerror() also gives a NULL pointer. Example:

>>> import dl
>>>"/usr/lib/", -1)
Erreur de segmentation (core dumped)

Workaround: use a static error message if dlerror() returns NULL.

I wrote a patch for dl_open() but other functions (in ctypes module?) 
should also call dlerror().
msg69432 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2008-07-08 13:45
As expected, the bug can be reproduced with ctypes.dlopen(). 
py_dl_open() function of Modules/_ctypes/callproc.c should be merged 
with Modules/dlmodule.c.

Here use at least the attached patch for ctypes (same job than the 
other patch: use default string if dlerror() returns NULL).
msg69703 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2008-07-15 18:35
I can confirm the problem on ubuntu linux.
msg69713 - (view) Author: Thomas Heller (theller) * (Python committer) Date: 2008-07-15 19:50
Thanks for the patch, fixed in trunk rev 64977 and py3k rev 64978.
Date User Action Args
2022-04-11 14:56:36adminsetgithub: 47563
2008-07-15 19:50:14thellersetstatus: open -> closed
resolution: fixed
messages: + msg69713
2008-07-15 18:35:11thellersetassignee: theller
messages: + msg69703
nosy: + theller
2008-07-08 13:45:57vstinnersetfiles: + ctypes_dlopen.patch
messages: + msg69432
2008-07-07 13:24:31vstinnercreate