Re: Test failure on MacOS X and Failure analysis

From: Date: Wed, 27 Jun 2007 06:57:20 +0000
Subject: Re: Test failure on MacOS X and Failure analysis
References: 1 2 3  Groups: php.qa 
Request: Send a blank email to php-qa+get-37123@lists.php.net to get a copy of this message
Failure analysis on Fedora core 3 32 bit. The testcase failing is rereadlink_realpath_basic.phpt. On 6/27/07, Raghubansh <softvirus@gmail.com> wrote:
Thank for comments! On 6/27/07, Hannes Magnusson <hannes.magnusson@gmail.com> wrote: Sorry for not reading this in more debt (currently on vacation), but there was one thing that caught my eye On 6/26/07, Raghubansh <softvirus@gmail.com> wrote:
Hi, Firstly many thanks to Tony, Hanne & Dmrity for providing all the
required
information which help me analyze various failure on MacOS X.
I am actually on FreeBSD..
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
This is expected behaviour on BSD realpath() and is not a bug. We however overwrite BSDs realpath() in ZTS... Also, Solaris implements rather weird (imo) realpath() were "sometimes" it returns _relative_ paths, not absolute, if you give it relative path.... realpath() returns NULL and sets errno to ENOENT as per the Linux manual on a given path that is non-existent, hence i think PHP should return bool(false) when given path is non-existent. The line no. 35 is the output of a path which is invalid and non-existent.
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.
This isn't a bug either, snip from realpath(3) manpages:
     The realpath() function will resolve both absolute and relative
paths and
     return the absolute pathname corresponding to pathname.  All but
the last
     component of pathname must exist when realpath() is called.
-Hannes 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.
Output lines indicating failure on Fedora core 3 32-bit ( readlink_realpath_basic.phpt) : --------------------------------- 041+ string(108) "/home/tony/php-src_5_2/ext/standard/tests/file/readlink_realpath_basic/home/test/readlink_realpath_basic.tmp" 041- bool(false) 067+ string(98) "/home/tony/php-src_5_2/ext/standard/tests/file/readlink_realpath_basic/readlink_realpath_basic.tmp" 067- bool(false) This is same as that of MacOS X failure. -- > with Regards, > Raghubansh -- with Regards, Raghubansh

« previous php.qa (#37123) next »