Hi, I have done more failure analysis on SuSE 9 64bit and FC 3 64bit, and found that most of the failures are identical.
Like to thank 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 SuSE 9 64-bit and FC 3 64-bit 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 is_readable() function: usage variations [ext/standard/tests/file/is_readable_variation.phpt] Test is_writable() and its alias is_writeable() function: usage variations [ext/standard/tests/file/is_writable_variation.phpt] Test readlink() and realpath functions: basic functionality [ext/standard/tests/file/readlink_realpath_basic.phpt] Test rename() function: usage variations [ext/standard/tests/file/rename_variation.phpt] Test symlink(), linkinfo(), link() and is_link() functions : error conditions [ext/standard/tests/file/symlink_link_linkinfo_is_link_error.phpt] ================================================================================ Failure in 007_error.phpt - FAILs only on FC 3 64-bit ================================================================================ Output lines indicating failure : --------------------------------- 068+ Warning: fopen(1): failed to open stream: Permission denied in /home/tony/php-src_5_2/ext/standard/tests/file/007_error.php on line 59 068- Warning: fopen(1): failed to open stream: No such file or directory in %s on line %d Explanation: ------------ The failure seen here is because of inconsistent behavior of fopen(). fopen() with first argument as boolean true( which will result as 1, and its an non-existent file) fails with message "No such file or directory" on Linux(RHEL4/5), WindowsXP, MacOs X, Fedora Core release 3 32bit and SuSE 9 64bit, but on FC 3 64-bit, it looks like it proceeds further and fails with Permission denied. I think the behavior should be made consistent across different platforms. I would consider raising a bugzilla if you agree. Code to reproduce the error: <?php var_dump( fopen(true, "r") ) ?> Expected result on Linux ( RHEL 5 ): ----------------------------------- Warning: fopen(1): failed to open stream: No such file or directory in %s on line %d bool(false) ================================================================================ Failure in is_readable_variation.phpt ( on SuSE 9 64bit & FC 3 64-bit ) ================================================================================ Output lines indicating failure : --------------------------------- 005+ bool(true) 005- bool(false) Explanation: ------------ is_readable() should fail when the given filename is having a trailing slash because it treats that as a dir. This behavior is found on most of the OS except SuSE 9 64bit and FC 3 64-bit where it passes. I beleive the behavior should be made consistent across OS and hence would like to raise a bugzilla if you agree. Code to reproduce the error: <?php $file = __FILE__."/"; // this file name ends with trailing slash var_dump( is_readable($file) ); ?> Expected result on Linux ( RHEL 5 ): ----------------------------------- bool(false) ================================================================================ Failure in is_writable_variation.phpt ( on SuSE 9 64bit & FC 3 64-bit ) ================================================================================ Output lines indicating failure : --------------------------------- 006+ bool(true) 007+ bool(true) 006- bool(false) 007- bool(false) Explanation: ------------ is_writable() & is_writeable() should fail when the given filename is having a trailing slash because it treats that as a dir. This behavior is found on most of the OS except SuSE 9 64bit and FC 3 64-bit. I beleive the behavior should be made consistent across OS and hence would like to raise a bugzilla if you agree. Code to reproduce the error: <?php $file = __FILE__."/"; // this file name with trailing slash var_dump( is_writable($file) ); var_dump( is_writeable($file) ); ?> Expected result on Linux ( RHEL 5 ): ----------------------------------- bool(false) bool(false) =============================================================================== Failure in readlink_realpath_basic.phpt ( on SuSE 9 64bit & FC 3 64-bit ) ================================================================================ Output lines indicating failure : --------------------------------- 041+ string(114) "/home.local/tony/php-src_5_2/ext/standard/tests/file/readlink_realpath_basic/home/test/readlink_realpath_basic.tmp" 041- bool(false) 067+ string(104) "/home.local/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 41 & 67, The given path is correct but since it end with a forward slash it fails on few OS and passes on other. The behavior of realpath() in PHP is in-consistent. On Linux ( I am using RHEL 5) with a path having trailing slash returns bool(false), however works fine on WinXP. I think, PHP should have consistent behavior. 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 rename_variation.phpt ( on SuSE 9 64bit & FC 3 64-bit ) ================================================================================ Output lines indicating failure : --------------------------------- 007+ bool(true) 008+ bool(false) 009+ bool(true) 010+ -- Iteration 3 -- 011+ bool(true) 012+ bool(false) 013+ bool(true) 014+ -- Iteration 4 -- 015+ bool(true) 016+ bool(false) 017+ bool(true) 008- Warning: rename(%s,%s): Not a directory in %s on line %d 010- bool(false) 012- 013- Warning: unlink(%s): No such file or directory in %s on line %d 018- -- Iteration 4 -- 019+ *** Testing rename() : renaming directory across directories *** 020+ -- Iteration 1 -- 021+ bool(true) 022- 023- *** Testing rename() : renaming directory across directories *** 024- -- Iteration 1 -- 023+ bool(true) 024+ -- Iteration 2 -- 025+ bool(true) 027+ bool(true) 028- -- Iteration 2 -- 032+ 033+ *** Testing rename() on soft links *** 032- -- Iteration 3 -- 037- *** Testing rename() on soft links *** 040+ 041+ *** Testing rename() on hard links *** 042+ 043+ Warning: link(): No such file or directory in /home.local/tony/php-src_5_2/ext/standard/tests/file/file.inc on line 384 045- *** Testing rename() on hard links *** 047- bool(false) 051+ *** Testing rename() by renaming a file, link and directory to numeric name *** 053- *** Testing rename() by renaming a file, link and directory to numeric name *** 056- bool(true) 057- bool(true) 059+ -- Renaming link to same link name -- 059- bool(true) 061+ 062+ -- Renaming file to same file name -- 064+ 065+ -- Renaming directory to same directory name -- 067+ 068+ -- Renaming existing link to existing directory name -- 069+ 070+ Warning: rename(/home.local/tony/php-src_5_2/ext/standard/tests/file/rename_variation_link.tmp,/home.local/tony/php-src_5_2/ext/standard/tests/file/rename_variation_dir): Is a directory in /home.local/tony/php-src_5_2/ext/standard/tests/file/rename_variation.php on line 182 072+ 073+ -- Renaming existing link to existing file name -- 076+ -- Renaming existing file to existing directory name -- 077+ 078+ Warning: rename(/home.local/tony/php-src_5_2/ext/standard/tests/file/rename_variation.tmp,/home.local/tony/php-src_5_2/ext/standard/tests/file/rename_variation_dir): Is a directory in /home.local/tony/php-src_5_2/ext/standard/tests/file/rename_variation.php on line 187 079+ bool(false) 080+ 081+ -- Renaming existing file to existing link name -- 083+ 084+ -- Renaming existing directory to existing file name -- 085+ 086+ Warning: rename(/home.local/tony/php-src_5_2/ext/standard/tests/file/rename_variation_dir,/home.local/tony/php-src_5_2/ext/standard/tests/file/rename_variation.tmp): Not a directory in /home.local/tony/php-src_5_2/ext/standard/tests/file/rename_variation.php on line 194 088+ 089+ -- Renaming existing directory to existing link name -- 090+ 091+ Warning: rename(/home.local/tony/php-src_5_2/ext/standard/tests/file/rename_variation_dir,/home.local/tony/php-src_5_2/ext/standard/tests/file/rename_variation_link.tmp): Not a directory in /home.local/tony/php-src_5_2/ext/standard/tests/file/rename_variation.php on line 196 093+ Done 060- 061- -- Renaming link to same link name -- 062- bool(true) 063- 064- -- Renaming file to same file name -- 065- bool(true) 066- 067- -- Renaming directory to same directory name -- 068- bool(true) 069- 070- -- Renaming existing link to existing directory name -- 071- 072- Warning: rename(%s,%s): Is a directory in %s on line %d 073- bool(false) 074- 075- -- Renaming existing link to existing file name -- 076- bool(true) 077- 078- -- Renaming existing file to existing directory name -- 079- 080- Warning: rename(%s,%s): Is a directory in %s on line %d 081- bool(false) 082- 083- -- Renaming existing file to existing link name -- 084- bool(true) 085- 086- -- Renaming existing directory to existing file name -- 087- 088- Warning: rename(%s,%s): Not a directory in %s on line %d 089- bool(false) 090- 091- -- Renaming existing directory to existing link name -- 092- 093- Warning: rename(%s,%s): Not a directory in %s on line %d 094- bool(false) 095- Done Explanation: ------------ The rename() function with source file having trailing slash fails on WinXP, RHEL 4, RHEL5. I think is the correct behavior because given the similar input to linux mv command also fails treating the input as a directory. On Fedora Core 3 64-bit and SLES 9 64-bit, rename succeeds when the source file name is given with trailing slash. I think this behavior should be made consistent with other OS. If you agree, i would consider raising a bugzilla. Code to reproduce the error: <?php $file_path = dirname(__FILE__); $src_filename = "$file_path/rename_variation.tmp/"; $fp = fopen("$file_path/rename_variation.tmp", "w"); if ($fp == false) echo "file could not be opened\n"; fclose($fp); $dest_filename = "$file_path/rename_variation2.tmp"; var_dump( rename($src_filename, $dest_filename) ); // ensure that file got renamed to new name var_dump( file_exists($src_filename) ); var_dump( file_exists($dest_filename) ); ?> Expected result on Linux ( RHEL 5 ): ----------------------------------- Warning: rename(%s,%s): Not a directory in %s on line %d bool(false) bool(false) bool(false) ================================================================================ Failure in symlink_link_linkinfo_is_link_error.phpt ( on SuSE 9 64bit & FC 3 64-bit ) ================================================================================ Output lines indicating failure : --------------------------------- 008+ bool(true) 009- Warning: symlink(): No such file or directory in %s on line %d 010+ Warning: symlink(): File exists in /home.local/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 013+ Warning: symlink(): File exists in /home.local/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 016+ Warning: symlink(): File exists in /home.local/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_error.php on line 34 018- Warning: symlink(): No such file or directory in %s on line %d 019+ Warning: symlink(): File exists in /home.local/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_error.php on line 35 021- Warning: symlink(): No such file or directory in %s on line %d 022+ Warning: symlink(): File exists in /home.local/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_error.php on line 36 024- Warning: symlink(): No such file or directory in %s on line %d 025- bool(false) 026- 032+ int(775) 033+ int(775) 034+ int(775) 035- Warning: linkinfo(): No such file or directory in %s on line %d 036- int(-1) 037- 038- Warning: linkinfo(): No such file or directory in %s on line %d 039- int(-1) 040- 044+ Warning: link(): File exists in /home.local/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_error.php on line 58 047+ Warning: link(): File exists in /home.local/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_error.php on line 59 049- Warning: link(): No such file or directory in %s on line %d 050+ Warning: link(): File exists in /home.local/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_error.php on line 60 052- Warning: link(): No such file or directory in %s on line %d 053+ Warning: link(): File exists in /home.local/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_error.php on line 61 055- Warning: link(): No such file or directory in %s on line %d 056+ Warning: link(): File exists in /home.local/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_error.php on line 62 058- Warning: link(): No such file or directory in %s on line %d 059+ Warning: link(): File exists in /home.local/tony/php-src_5_2/ext/standard/tests/file/symlink_link_linkinfo_is_link_error.php on line 63 061- Warning: link(): No such file or directory in %s on line %d 064- Warning: link(): No such file or directory in %s on line %d ================================================================================ Explanation: ------------ These failures are because of wrong behavior of symlink(), linkinfo() and link(). These functions are working fine when first(source) or second(destination, i.e linkname) arguments are given as following: NULL, '', and false ( a boolean value ). I think this is a bug, because invalid inputs are not being handled correctly. This works fine on other OS. If you agree, i would consider raising a bug. Code to reproduce the error: <?php $filename = dirname(__FILE__)."/file.tmp"; $fp = fopen($filename, "w"); fclose($fp); $linkname = dirname(__FILE__)."/link.tmp"; //invalid arguments var_dump( symlink(NULL, $linkname) ); // NULL as filename var_dump( symlink('', $linkname) ); // empty string as filename var_dump( symlink(false, $linkname) ); // boolean false as filename var_dump( symlink($filename, NULL) ); // NULL as linkname var_dump( symlink($filename, '') ); // '' as linkname var_dump( symlink($filename, false) ); // false as linkname //invalid arguments var_dump( linkinfo(NULL) ); // NULL as linkname var_dump( linkinfo('') ); // empty string as linkname var_dump( linkinfo(false) ); // boolean false as linkname //invalid arguments var_dump( link(NULL, $linkname) ); // NULL as filename var_dump( link('', $linkname) ); // empty string as filename var_dump( link(false, $linkname) ); // boolean false as filename var_dump( link($filename, NULL) ); // NULL as linkname var_dump( link($filename, '') ); // '' as linkname var_dump( link($filename, false) ); // false as linkname // delete temp file unlink($filename); ?> 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) 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) Warning: linkinfo(): No such file or directory in %s on line %d int(-1) Warning: linkinfo(): No such file or directory in %s on line %d int(-1) Warning: linkinfo(): No such file or directory in %s on line %d int(-1) Warning: link(): No such file or directory in %s on line %d bool(false) Warning: link(): No such file or directory in %s on line %d bool(false) Warning: link(): No such file or directory in %s on line %d bool(false) Warning: link(): No such file or directory in %s on line %d bool(false) Warning: link(): No such file or directory in %s on line %d bool(false) Warning: link(): No such file or directory in %s on line %d bool(false) -- with Regards, Raghubansh