[Python-bugs-list] [ python-Bugs-505417 ] Dynamic loading bug on HPUX
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 21 Jan 2002 07:23:21 -0800
Bugs item #505417, was opened at 2002-01-18 07:48
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=505417&group_id=5470
Category: Python Interpreter Core
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Eddy De Greef (edg)
>Assigned to: Martin v. Löwis (loewis)
Summary: Dynamic loading bug on HPUX
Initial Comment:
When a shared library is found on HPUX, but the
requested symbol cannot be found, the dynamic
loading function returns a random pointer,
causing a crash soon afterwards.
Python/dynload_hpux.c, line 50:
shl_findsym(&lib, funcname, TYPE_UNDEFINED, (void *)
&p);
I suggest initializing p to NULL explicitly or
checking the return value of shl_findsym(): -1 is
returned on error.
----------------------------------------------------------------------
Comment By: Eddy De Greef (edg)
Date: 2002-01-21 07:18
Message:
Logged In: YES
user_id=73597
The man page says:
DIAGNOSTICS
If a library cannot be loaded,
shl_load() returns NULL and sets errno
to indicate the error. All other
functions return -1 on error and set
errno.
If shl_findsym() cannot find the
indicated symbol, errno is set to zero.
If shl_findsym() finds the indicated
symbol but cannot resolve all the
symbols it depends on, errno is set to
ENOSYM.
I've attached a patch (tested on HPUX10 and HPUX11).
Apart from checking and returning a NULL pointer, it
also unloads the shared library in case the symbol
is not found.
Without this unloading, the Python build process fails
because it tries to remove a text file that is busy (and
it's cleaner to unload the library anyhow in case of a
failure).
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2002-01-18 13:06
Message:
Logged In: YES
user_id=21627
Can you please refer us to online documentation for
shl_findsym? Or betterm can you provide a tested patch?
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=505417&group_id=5470