Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a line in a script that looks like this:
opendir(DIR, $Path->{'real'});
This call returns false. The value of $Path->{'real'} is defined by a module that gets the value from a conf file. If I print out the value I get the following:
/usr/
This directory of course exists, so the following code returns true:
opendir(DIR, "/usr/");
Strangely, so does this code:
$Path->{'real'} = "/usr/"; opendir(DIR, $Path->{'real'});
This led me to think $Path->{'real'} was tainted and therefore not usable in the opendir call, however it still doesn't work if I untaint it like so:
$Path->{'real'} =~ /(.*)/; $Path->{'real'} = $1; opendir(DIR, $Path->{'real'});
This code is a functioning part of mozilla.org's installation of LXR running on a Solaris box with perl 5.004. I am trying to get it working on my own RedHat Linux 7.0 machine running 5.6.1. What could be going wrong here?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: why would opendir fail?
by redcloud (Parson) on Apr 28, 2001 at 17:48 UTC | |
by Anonymous Monk on Apr 28, 2001 at 19:43 UTC | |
|
Re: why would opendir fail?
by BMaximus (Chaplain) on Apr 28, 2001 at 12:42 UTC |