python stripping LD_LIBRARY_PATH?

Jeff Shipman - SysProg jeff at nmt.edu
Tue Feb 26 14:08:42 EST 2002


I never got a response to this and I really don't
understand why it's happening. I would appreciate
any help anyone can give me. If there's another place
I should be posting this, please let me know.

-------- Original Message --------

I've got a wrapper so I can run a SUID python script which
looks like the following:

#include <unistd.h>

int main(int argc, char **argv)
{
    char *env[] = { "TERM=linux",
                    "LD_LIBRARY_PATH=" ORACLE_HOME "/lib",
                    "SHELL=/bin/sh",
                    "PATH=/usr/local/bin:/bin:" ORACLE_HOME "/bin",
                    "ORACLE_HOME=" ORACLE_HOME,
                    "ORACLE_SID=" ORACLE_SID,
                    '\0' };
//  execve("/u/buch/bin/late_books.py", argv, env);
    execve("./late_books.py", argv, env);
    return 0;
}

I have the line commented out so I can test for the
moment.

The problem I'm having is that the LD_LIBRARY_PATH
is not showing up in os.environ. Everything else shows
up just fine. It prints out as:

{'ORACLE_SID': 'tcc', 'PATH':
'/usr/local/bin:/bin:/fs/oracle/linux/app/oracle/product/8.0.5/bin',
'ORACLE_HOME': '/fs/oracle/linux/app/oracle/product/8.0.5', 'SHELL':
'/bin/sh', 'TERM': 'linux'}

This is a problem because I really must set LD_LIBRARY_PATH
before starting this script. I've tried setting the LD_LIBRARY_PATH
inside the script before importing the Oracle module, and that
doesn't work (which is odd).

Why is python stripping out this environment variable?

I'm using:

ActivePython 2.1, build 211 (ActiveState)
based on Python 2.1 (#1, Jun 15 2001, 02:52:41)
[GCC 2.95.2 20000220 (Debian GNU/Linux)] on linux2

Any help would be extremely appreciated.

-- 
Jeff Shipman           E-Mail: jeff at nmt.edu
Systems Programmer     Phone: (505) 835-5748
NMIMT Computer Center  http://www.nmt.edu/~jeff




More information about the Python-list mailing list