Re: [PHP-DEV] Re: Current working directory and multi-threaded environments From: Sascha Schumann (sascha <email protected>)
Date: 03/16/00

On Thu, Mar 16, 2000 at 06:57:22PM +0200, Andi Gutmans wrote:
> Guys,
>
> I just commited a file php_virtual_chdir.c to our CVS. It has a main() in
> it so you can compile it and run it.
> I want to base the new virtual current working directory on this code,
> which seems to work pretty well and normalizes the names of the
> directories. Look at the main and see that it deals very nicely with all
> sorts of scenarios.
> There are two main issues with this code:
> a) It doesn't *really* check if the directory exists.
> b) strtok() isn't thread-safe in all machine's. I think we have the
> necessary #define's to strtok_r for most platforms though. In any case, we
> can either use something small we write ourselves.

Why not use strtok_r directly?

> c) Doesn't expand ~ yet.
> d) No error handling yet.
> e) no virtual_expand_filepath() yet, which is exactly the same as
> the existing virtual_chdir. I think the real virtual_chdir() will probably
> wrap this function and maybe do some other checks which chdir() requires.

f) does not handle COMMAND.COM special cases (i.e. "..."). This has been
a nasty security problem for many programs handling paths on Win16/32,
so we should try to cover this.

g) what about other O/S?

- Sascha

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: php-dev-unsubscribe <email protected>
For additional commands, e-mail: php-dev-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>