At 02:30 AM 1/25/2003 -0800, Rasmus Lerdorf wrote:
> That said, we could possibly have a fast mode and use fstat() to get some
> device information on the open file. I am worried about functionality
> though. I'm not sure it's worth breaking.

Yes, fstat() is fast.  And perhaps it isn't worth breaking functionality
across the board, but in my particular case I don't really have a choice.
It is simply too slow to handle the loads that it needs to handle and
either I need to get twice as many machines or I need to lose some
functionality.

Another idea would be to try to streamline the normal case for an absolute
pathname.  How about doing a readlink() on it.  If that tells us that it
is a link, then we know there is something funky and we can do a realpath,
otherwise we just assume it is canonical assuming there are no . .. or //
in the filename in which case we fall back to a realpath() as well.
Hmm I'm not sure this would give you what you're looking for. I think it only works if the last element of the path is a symbolic link but I might be wrong. I'm not quite sure of the semantics of readlink().

Or, the really straightforward dumbass solution, have some hint we can
pass along that tells the parser to treat what follows as a canonical
filename.

  include "\001/home/rasmus/foo/u2.inc";

A bit too hacky I guess.  Perhaps something like:

  include_canonical "/home/rasmus/foo/u2.inc";

And we would simply assume that this is a canonical filename and skip all
the checks.  This last one is probably what I will need to do, but I will
do some tests on the readlink() optimization and see if that buys me
anything.
I think both of these solutions are too hacky. If we end up deciding that it makes sense to have a mode which uses fstat() then we should probably just document what we believe could break and with a "use this with care!" warning.
I'm going to try and think if there are other options which won't break functionality.
Andi


--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to