os.environ['PATH'] missing

Jorgen Grahn grahn+nntp at snipabacken.dyndns.org
Sun Jan 8 06:03:39 EST 2006


On 6 Jan 2006 06:03:05 -0800, peterbe at gmail.com <peterbe at gmail.com> wrote:
...
> How can it not be present?
> What might cause this seemingly random situation?

Well, it's not uncommon to start a program with a reduced set of environment
variables, including a limited, hardcoded $PATH, so something like
os.system("ls") cannot be tricked to run an ls outside the
system-controlled, "safe" directories.

On my machine, "env -i sh" starts a shell without $PATH. Bash seems to
default to a builtin search path in that situation (/bin and /usr/bin, I
suppose).

But reducing $PATH is one thing (and fairly common); removing it is another.
And I'm not sure that programs are expected to cope with the absence of
$PATH; just because it's /possible/ to remove it doesn't mean it's legal.

I don't know anything about web servers and Zope. Sorry.

/Jorgen

-- 
  // Jorgen Grahn <grahn@        Ph'nglui mglw'nafh Cthulhu
\X/     snipabacken.dyndns.org>  R'lyeh wgah'nagl fhtagn!



More information about the Python-list mailing list