#42038 [Fbk->Opn]: realpath does not resolve symbolic link

[email protected] ("kraghuba at in dot ibm dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
 ID:               42038
 User updated by:  kraghuba at in dot ibm dot com
 Reported By:      kraghuba at in dot ibm dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         Filesystem function related
 Operating System: MacOSX, FreeBSD
 PHP Version:      5CVS-2007-07-18 (snap)
 Assigned To:      fb-req-jani
 New Comment:

Hi Jani,

I do not MacOSX/FreeBSD system to verify this. If you know someone who
has, pls request for verfication. 

PS: When i raised this defect ,i used test run report sent by others
over the php-qa list.

with Regards,
Raghubansh


Previous Comments:
------------------------------------------------------------------------

[2008-08-12 08:54:11] [email protected]

I'm guessing this should be fixed in PHP_5_3 and HEAD by the commit by
Dmitry?

------------------------------------------------------------------------

[2007-07-19 03:21:44] kraghuba at in dot ibm dot com

The reference to testcase symlink_link_linkinfo_is_link_variation6.phpt
is wrong. The write testcases to check are :
ext/standard/tests/file/readlink_realpath_basic1.phpt
ext/standard/tests/file/readlink_realpath_variation1.phpt
ext/standard/tests/file/readlink_realpath_variation2.phpt

The similar failure is also noticed on FreeBSD.
(FreeBSD - FreeBSD lindsay.php.is 6.2-STABLE FreeBSD 6.2-STABLE #1: Thu
Jun 28 22:12:54 CEST 2007 )

MACOSX details:
Darwin - Darwin thought 8.10.1 Darwin Kernel Version 8.10.1: Wed May 23
16:33:00 PDT 2007; root:xnu-792.22.5~1/RELEASE_I386 i386

------------------------------------------------------------------------

[2007-07-18 17:16:51] kraghuba at in dot ibm dot com

Description:
------------
realpath() doesn't resolve symlink and returns the link file name when
input path is a link path.

As per the documentation at
http://in.php.net/manual/en/function.realpath.php, The resulting path
will have no symbolic link, '/./' or '/../' components.

Applicable to php5.2.4 only on MacOS X.

Please check testcase symlink_link_linkinfo_is_link_variation6.phpt.


Reproduce code:
---------------
<?php
$file_path = dirname(__FILE__);
$filename = "$file_path/file.tmp";
$linkname = "$file_path/link.tmp";

$fp = fopen($filename, "w");
fclose($fp);

symlink($filename, $linkname); 
var_dump( realpath($linkname) );

unlink($linkname);
unlink($filename);
?>

Expected result:
----------------
string(%d) "%s/file.tmp"

Actual result:
--------------
string(%d) "%s/link.tmp"


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42038&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.