Re: [ZEND-ENGINE-CVS] cvs: TSRM / tsrm_virtual_cwd.h

From: Date: Wed, 11 Dec 2002 07:06:10 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: TSRM / tsrm_virtual_cwd.h
References: 1  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-709@lists.php.net to get a copy of this message
On December 11, 2002 12:16 am, Andi Gutmans wrote: > This is not the correct patch but adds other bugs. You should check for UNC > separetely in the code like in virtual_realpath(). IS_ABSOLUTE_PATH() is > only meant to detect the drive letter and is always followed by use of > COPY_WHEN_ABSOLUTE() (which happens to also be 2 but it's still not right. > Stuff might break). The patch only affects the behavior of IS_ABSOLUTE_PATH on Win32 where UNC path is absolute. PHP's behavior is the same when either IS_ABSOLUTE_PATH or IS_UNC_PATH occur. Separation of the two, only adds another len >= 2 check, beyond that nothing else changes. I do not see how this can break any existing code on Win32 platform, perhaps you could offer me some hints about situations where this may cause problems? I've looked at the usage of IS_ABSOLUTE_PATH macro and it is only used 4 times outside of TSRM/tsrm_virtual_cwd.c, where it only used in 2 functions. From what I've been able to see the change does not break any existing code. It can however prevent problems for paths on Win32 that begin with \\ or //, since unless the UNC check is explicitly done the code will try to 'resolve' those paths breaking them in the process. Ilia > if (IS_ABSOLUTE_PATH(path_copy, path_length)) { > copy_amount = COPY_WHEN_ABSOLUTE(path_copy); > is_absolute = 1; > #ifdef TSRM_WIN32 > } else if (IS_UNC_PATH(path_copy, path_length)) { > copy_amount = 2; > is_absolute = 1; > } else if (IS_SLASH(path_copy[0])) { > copy_amount = 2; > #endif > } > > Andi > > At 12:32 AM 12/11/2002 +0000, Ilia Alshanetsky wrote: > >iliaa Tue Dec 10 19:32:34 2002 EDT > > > > Modified files: > > /TSRM tsrm_virtual_cwd.h > > Log: > > On Win32 make PHP treat UNC paths as absolute paths, this should solve > > bugs such as #20831. Thanks to Wez Furlong for isolating the problem. > > > > > >Index: TSRM/tsrm_virtual_cwd.h > >diff -u TSRM/tsrm_virtual_cwd.h:1.27 TSRM/tsrm_virtual_cwd.h:1.28 > >--- TSRM/tsrm_virtual_cwd.h:1.27 Fri Nov 15 11:36:55 2002 > >+++ TSRM/tsrm_virtual_cwd.h Tue Dec 10 19:32:33 2002 > >@@ -17,7 +17,7 @@ > > > > +----------------------------------------------------------------------+ > > */ > > > >-/* $Id: tsrm_virtual_cwd.h,v 1.27 2002/11/15 16:36:55 iliaa Exp $ */ > >+/* $Id: tsrm_virtual_cwd.h,v 1.28 2002/12/11 00:32:33 iliaa Exp $ */ > > > > #ifndef VIRTUAL_CWD_H > > #define VIRTUAL_CWD_H > >@@ -58,7 +58,7 @@ > > */ > > #define COPY_WHEN_ABSOLUTE(path) 2 > > #define IS_ABSOLUTE_PATH(path, len) \ > >- (len >= 2 && isalpha(path[0]) && path[1] == ':') > >+ (len >= 2 && ((isalpha(path[0]) && path[1] == ':') || > >(IS_SLASH(path[0]) && IS_SLASH(path[1])))) > > #define IS_UNC_PATH(path, len) \ > > (len >= 2 && IS_SLASH(path[0]) && IS_SLASH(path[1])) > > > > > > > > > >-- > >Zend Engine CVS Mailing List (http://cvs.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.zend-engine.cvs (#709) next »