dl + getenv (without arguments) = segfault (python2.p2, python2.3)

Xavier sabu at pure-elite.org
Wed Aug 6 18:26:43 EDT 2003


Greetings,

While messing around with the "dl" module I ran into a segfault.

*DO NOTE THAT THE FOLLOWING OCCURED ON 2 OF MY LINUX WORKSTATIONS*
------
# python -c 'import dl; a=dl.open("libc.so.6"); print a.call("getenv")'

or while in the interpreter:

import dl

a=dl.open("libc.so.6")
print a.call("getenv")
------


After discussing the issue with a counterpart, and thinking logically in
the case of getenv(const char *name) -- the call segfaults because of the
missing *name, variable.  Now, my problem is not with the obvious.. but
with the fact that Python segfaulted instead of raising an exception or
returning 0 (in the case of my netbsd box with: Python 2.3 (#1, Aug  6
2003, 00:29:47)//[GCC 2.95.3 20010315 (release) (NetBSD nb3)] on netbsd1).

Thanks, and sorry if this issue has been brought up already.

Here is the full log from all 3 machines I tested it on:

#1
--> python
Python 2.3 (#1, Aug  6 2003, 00:29:47)
[GCC 2.95.3 20010315 (release) (NetBSD nb3)] on netbsd1
Type "help", "copyright", "credits" or "license" for more information.
>>> import dl
>>> a=dl.open('libc.so.12.83.1')
>>> print a.call('getenv')
0

#2
sabu at culprit:/root$ python
Python 2.2.3+ (#1, Jul  5 2003, 11:04:18)
[GCC 3.3.1 20030626 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dl
>>> a=dl.open('libc.so.6')
>>> print a.call('getenv')
Segmentation fault
sabu at culprit:/root$

#3
root at tixdev:~# python2.2
Python 2.2.3+ (#1, Jul  5 2003, 11:04:18)
[GCC 3.3.1 20030626 (Debian prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dl
>>> a=dl.open('libc.so.6')
>>> print a.call('getenv')
Segmentation fault
root at tixdev:~#

--Xavier.















More information about the Python-list mailing list