Hi, Firstly many thanks to Tony, Hanne & Dmrity for providing all the required information which help me analyze various failure on MacOS X.
The analysis is bit lengthier, my apologies for the lengthy note. Appreciate any feedback and comment, that would be helpful in analyzing the failure on other OS, which is in progress. I do not have a MacOS X system, but tried to put the analysis, please feel free to correct me if i am wrong. Below analysis contains the following : The failure out difference as generated by run-test.php Analysis of failure, A sample testcode which can be run to verify the failure/behavior & Expected output on RHEL 5. Following testcases are failing and have been analyzed : Test filesize() function: usage variations [ext/standard/tests/file/filesize_variation.phpt] Test popen() and pclose function: error conditions [ext/standard/tests/file/popen_pclose_error.phpt] Test readlink() and realpath functions: basic functionality [ext/standard/tests/file/readlink_realpath_basic.phpt] Test readlink() and realpath() functions: error conditions [ext/standard/tests/file/readlink_realpath_error.phpt] Test readlink() and realpath() functions: usage variation [ext/standard/tests/file/readlink_realpath_variation.phpt] Test symlink(), linkinfo(), link() and is_link() functions : error conditions [ext/standard/tests/file/symlink_link_linkinfo_is_link_error.phpt] Test symlink(), linkinfo(), link() and is_link() functions : usage variations [ext/standard/tests/file/symlink_link_linkinfo_is_link_variation.phpt] ================================================================================ Failure in filesize_variation.phpt ================================================================================ Output lines indicating failure : --------------------------------- 016+ int(68) 016- int(4096) 018+ int(102) 018- int(4096) 021+ int(102) 022+ int(68) 021- int(4096) 022- int(4096) 024+ int(102) 025+ int(102) 024- int(4096) 025- int(4096) Explanation: ------------ There is a difference in the size of a dir when created. On Linux its is 4096 by default but on MacOS its 68 and then changes when a new file/subdir is created inside the dir. I suggest that we have seperate testcase for MacOs or just do the check for %d or %i in place of size. Here is the sample code to reproduce this: <?php $filepath = dirname(__FILE__); // create dir and check size mkdir(dirname(__FILE__)."/temp"); var_dump( filesize($filepath."/temp") ); mkdir($filepath."/temp/subdir"); var_dump( filesize($filepath."/temp/subdir") ); // remove temp dir rmdir( $filepath."/temp/subdir"); rmdir( $filepath."/temp"); ?> Expected result on Linux ( RHEL 5 ): ----------------------------------- int(4096) int(4096) ================================================================================ Failure in popen_pclose_error.phpt ================================================================================ Output lines indicating failure : --------------------------------- 009+ Warning: popen(abc.txt,rw): Inappropriate ioctl for device in /private/var/root/tony/php-src_5_2/ext/standard/tests/file/popen_pclose_error.php on line 13 009- Warning: popen(abc.txt,rw): Invalid argument in %s on line %d Explanation: ------------ The behavior of popen() is expected to be saying "Invalid argument ...." but looks like it tried to proceed with the given wrong input and finally fails. I think this looks like a bug, If you agree I'll raise bugzilla. Code for reproducing the error: <?php var_dump( popen("abc", "rw") ); // with invalid mode argument ?> Expected result on Linux ( RHEL 5 ): ----------------------------------- Warning: popen(abc.txt,rw): Invalid argument in %s on line %d ================================================================================ Failure in readlink_realpath_basic.phpt ================================================================================ Output lines indicating failure : --------------------------------- 035+ string(117) "/private/var/root/tony/php-src_5_2/ext/standard/tests/file/readlink_realpath_basic/..readlink_realpath_basic_link.tmp" 035- bool(false) 039+ Warning: readlink(): Invalid argument in /private/var/root/tony/php-src_5_2/ext/standard/tests/file/readlink_realpath_basic.php on line 48 039- Warning: readlink(): Not a directory in %s on line %d 041+ string(120) "/private/var/root/tony/php-src_5_2/ext/standard/tests/file/readlink_realpath_basic/home/test/readlink_realpath_basic.tmp" 041- bool(false) 067+ string(110) "/private/var/root/tony/php-src_5_2/ext/standard/tests/file/readlink_realpath_basic/readlink_realpath_basic.tmp" 067- bool(false) Explanation: ------------ The failure on line number 35 is coming from realpath(). The expected output is bool(false) because given path is invalid and nonexistent. I think this looks like a bug, If you agree I'll raise bugzilla The failure on line number 41 & 67, The given path is correct but since it end with a forward slash, it should be treated as dir and hence non-existing The function seems to not behave correctly. I think this looks like a bug, If you agree I'll raise bugzilla. The failure on line number 39, is coming from readlink(). The given path exists and ends with a slash, hence it should be treated as directory (as it does on Linux) but here the error indicates that its an invalid argument. On linux it indicates that "its Not an directory". I think the behavior should be consistent, If you agree I'll raise bugzilla. Code to reproduce the error: <?php // realpath with invalid and nonexistent path $path = dirname(_FILE__)."/..".basename(__FILE__); echo $path."\n"; var_dump( realpath($path) ); $path = __FILE_."/"; // correct path ending with slash echo $path."\n"; var_dump( realpath($path) ); // readlink with invalid path $file = FILE; $link = dirname(__FILE__)."/mylink.tmp"; var_dump( symlink($file, $link) ); var_dump( readlink($link."/") ); // link path ending with slash // remove temp link unlink($link); ?> Expected result on Linux ( RHEL 5 ): ----------------------------------- /workdir/test/fail/..realpath.php bool(false) /workdir/test/fail/realpath.php/ bool(false) bool(true) Warning: readlink(): No such file or directory in %s on line %d bool(false) ================================================================================ Failure in readlink_realpath_error.phpt ================================================================================ Output lines indicating failure : --------------------------------- 032+ string(77) "/private/var/root/tony/php-src_5_2/ext/standard/tests/file/realpath_error.tmp" 032- bool(false) Explanation: ------------ The failure is coming from realpath with nonexistent file. The expected output should be bool(false) where as here the realpath returns the given input as output. I think this looks like a bug, If you agree I'll raise bugzilla Code to re-produce the error: <?php var_dump( realpath( dirname(__FILE__)."/non_existent_file.tmp") ); ?> Expected result on Linux ( RHEL 5 ): ----------------------------------- bool(false) ================================================================================ Failure in readlink_realpath_variation.phpt ================================================================================ Output lines indicating failure : --------------------------------- 062+ string(36) "/private/var/root/tony/php-src_5_2/ " 062- bool(false) 067+ string(36) "/private/var/root/tony/php-src_5_2/ " 067- bool(false) Explanation: ------------ Here both the failure as coming because of " " and ' ' being passed to realpath. The expected behaviour should be bool(false) because given path doesn't exist. I think this looks like a bug, If you agree I'll raise bugzilla. Code to reproduce the error: <?php var_dump( realpath(" ") ); var_dump( realpath(' ') ); ?> Expected result on Linux ( RHEL 5 ): ----------------------------------- bool(false) bool(false) ================================================================================ failure in symlink_link_linkinfo_is_link_error.phpt ================================================================================ Output lines indicating failure : --------------------------------- 009+ Warning: symlink(): Invalid argument in /private/var/root/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_error.php on line 31 009- Warning: symlink(): No such file or directory in %s on line %d 012+ Warning: symlink(): Invalid argument in /private/var/root/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_error.php on line 32 012- Warning: symlink(): No such file or directory in %s on line %d 015+ Warning: symlink(): Invalid argument in /private/var/root/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_error.php on line 33 015- Warning: symlink(): No such file or directory in %s on line %d 041+ Warning: linkinfo(): No such file or directory in /private/var/root/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_error.php on line 48 042+ int(-1) 043+ Explanation: ------------ Here the failures( line no 9, 12 & 15) come from symlink() with first argument supplied as : NULL, '' & false The output on Linux and MacOS are not similar, I think the output should be consistent. If you agree I'll raise bugzilla. Code to reproduce the error: <?php $link = "./link.tmp"; var_dump( symlink(NULL, $link) ); var_dump( symlink('', $link) ); var_dump( symlink(false, $link) ); ?> Expected result on Linux ( RHEL 5 ): ----------------------------------- Warning: symlink(): No such file or directory in %s on line %d bool(false) Warning: symlink(): No such file or directory in %s on line %d bool(false) Warning: symlink(): No such file or directory in %s on line %d bool(false) ---------------- Failure in line no 41, 42, 43 needs fix in testcase and/or run-test.php. ================================================================================ Failure in symlink_link_linkinfo_is_link_variation.phpt ================================================================================ Output lines indicating failure : --------------------------------- 001+ Warning: mkdir(): File exists in /private/var/root/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation.php on line 18 103+ bool(true) 104+ int(234881026) 105+ bool(true) 103- Warning: symlink(): Permission denied in %s on line %i 106- Warning: linkinfo(): Permission denied in %s on line %i 107- int(-1) 107+ -- Working with hard links -- 108+ 109+ Warning: link(): File exists in /private/var/root/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation.php on line 284 110- -- Working with hard links -- 111+ int(234881026) 112+ bool(true) 112- Warning: link(): Permission denied in %s on line %i 114+ *** Create soft link to file and then to itself *** 115+ bool(true) 116+ 117+ Warning: symlink(): File exists in /private/var/root/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation.php on line 304 118+ bool(false) 119+ 120+ *** Create soft link to directory and then to itself *** 121+ bool(true) 122+ 123+ Warning: symlink(): File exists in /private/var/root/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation.php on line 312 124+ bool(false) 125+ 126+ *** Create hard link to file and then to itself *** 127+ bool(true) 128+ 129+ Warning: link(): File exists in /private/var/root/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation.php on line 320 115- Warning: linkinfo(): Permission denied in %s on line %i 116- int(-1) 119- *** Create soft link to file and then to itself *** 121- 122- Warning: symlink(): File exists in %s on line %i 123- bool(false) 124- 125- *** Create soft link to directory and then to itself *** 126- bool(true) 127- 128- Warning: symlink(): File exists in %s on line %i 129- bool(false) 130- 131- *** Create hard link to file and then to itself *** 132- bool(true) 133- 134- Warning: link(): File exists in %s on line %i 135- bool(false) 136- 137- *** Create hard link in different directory with same filename *** 138- 139- Warning: link(): File exists in %s on line %i 140- bool(false) 141- bool(true) 142- 143- *** Create soft link in different directory with same filename *** 144- 145- Warning: symlink(): File exists in %s on line %i 146- bool(false) 147- bool(true) 148- 149- *** Checking lstat() on soft link *** 132+ *** Create hard link in different directory with same filename *** 134+ Warning: link(): File exists in /private/var/root/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation.php on line 336 136+ bool(true) 138+ *** Create soft link in different directory with same filename *** 139+ 140+ Warning: symlink(): File exists in /private/var/root/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_variation.php on line 356 142+ bool(true) 144+ *** Checking lstat() on soft link *** 146+ array(26) { 147+ [0]=> 148+ int(234881026) 149+ [1]=> 150+ int(44378171) 151+ [2]=> 152+ int(41453) 153+ [3]=> 154+ int(1) 155+ [4]=> 156+ int(0) 157+ [5]=> 158+ int(0) 159+ [6]=> 160+ int(0) 161+ [7]=> 162+ int(122) 163+ [8]=> 164+ int(1182842786) 165+ [9]=> 166+ int(1182842786) 167+ [10]=> 168+ int(1182842786) 169+ [11]=> 170+ int(4096) 171+ [12]=> 172+ int(8) 173+ ["dev"]=> 174+ int(234881026) 175+ ["ino"]=> 176+ int(44378171) 177+ ["mode"]=> 178+ int(41453) 179+ ["nlink"]=> 180+ int(1) 181+ ["uid"]=> 182+ int(0) 183+ ["gid"]=> 184+ int(0) 185+ ["rdev"]=> 186+ int(0) 187+ ["size"]=> 188+ int(122) 189+ ["atime"]=> 190+ int(1182842786) 191+ ["mtime"]=> 192+ int(1182842786) 193+ ["ctime"]=> 194+ int(1182842786) 195+ ["blksize"]=> 196+ int(4096) 197+ ["blocks"]=> 198+ int(8) 199+ } 200+ 201+ linkinfo() value matches lstat['dev'] 202+ 203+ *** Checking lstat() on hard link *** 159- int(1) 185- int(1) 208- *** Checking lstat() on hard link *** 213+ int(2) 218- int(2) 239+ int(2) 244- int(2) 262+ *** Checking lstat() on a soft link to directory *** 266- 272+ int(1) 298+ int(1) 320+ Done 267- *** Checking lstat() on a soft link to directory *** 268- bool(true) 269- array(26) { 270- [0]=> 271- int(%i) 272- [1]=> 273- int(%i) 274- [2]=> 275- int(%i) 276- [3]=> 277- int(1) 278- [4]=> 279- int(%i) 280- [5]=> 281- int(%i) 282- [6]=> 283- int(%i) 284- [7]=> 285- int(%i) 286- [8]=> 287- int(%i) 288- [9]=> 289- int(%i) 290- [10]=> 291- int(%i) 292- [11]=> 293- int(%i) 294- [12]=> 295- int(%i) 296- ["dev"]=> 297- int(%i) 298- ["ino"]=> 299- int(%i) 300- ["mode"]=> 301- int(%i) 302- ["nlink"]=> 303- int(1) 304- ["uid"]=> 305- int(%i) 306- ["gid"]=> 307- int(%i) 308- ["rdev"]=> 309- int(%i) 310- ["size"]=> 311- int(%i) 312- ["atime"]=> 313- int(%i) 314- ["mtime"]=> 315- int(%i) 316- ["ctime"]=> 317- int(%i) 318- ["blksize"]=> 319- int(%i) 320- ["blocks"]=> 321- int(%i) 322- } 323- 324- linkinfo() value matches lstat['dev'] 325- Done Explanation: ------------ There two thing in the failure. 1. We see that the temp dir created by the tests already exists, may be not cleaned by previous tests ( i.e symlink_link_linkinfo_is_link.basic/error.phpt ). The code pretty much there to clean the dir created but looks like there could be problem, Please could you run only these three tests and let us know the result , in case of failure, pls provide diff file and output of command "ls -l" on the dir where test is run files are( please run the below sequnce only): symlink_link_linkinfo_is_link_basic.phpt symlink_link_linkinfo_is_link_error.phpt symlink_link_linkinfo_is_link_variation.phpt 2. The other failure here is because of the directory permission is not respected by symlink() and link command. When the dir doesnot have permission to create a file inside it, the symlink() and link() are still creating the files in it. I think this looks like a bug, If you agree I'll raise bugzilla Code to reproduce this: <?php $dirname = dirname(_FILE_)."/temp"; mkdir($dirname); $filename = __FILE; // remove all permissions from dir chmod($dirname, 0000); // expected: false var_dump( symlink($filename, "$dirname/non_existent_link.tmp") ); var_dump( linkinfo("$dirname/non_existent_link.tmp") ); var_dump( is_link("$dirname/non_existent_link.tmp") ); // clear the cache clearstatcache(); rmdir($dirname); ?> Expected result on Linux ( RHEL 5 ): ----------------------------------- Warning: symlink(): Permission denied in %s on line %d bool(false) Warning: linkinfo(): Permission denied in %s on line %d int(-1) bool(false) On 6/26/07, Antony Dovgal <[EMAIL PROTECTED]> wrote:
On 26.06.2007 11:00, Raghubansh wrote: > Tony, Please provide the diff. files. Thanks More test results: http://news.php.net/php.qa/36961 - Sun Solaris 10 -- Wbr, Antony Dovgal
-- with Regards, Raghubansh