Bug #77639 [ReO->Dup]: realpath resolves NTFS junctions which are not symlinks

From: Date: Wed, 22 Sep 2021 09:45:25 +0000
Subject: Bug #77639 [ReO->Dup]: realpath resolves NTFS junctions which are not symlinks
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-236737@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77639&edit=1 ID: 77639 Updated by: cmb@php.net Reported by: mesaverde228 at gmail dot com Summary: realpath resolves NTFS junctions which are not symlinks -Status: Re-Opened +Status: Duplicate Type: Bug Package: *Directory/Filesystem functions Operating System: Windows/Linux PHP Version: 7.1.26 -Assigned To: +Assigned To: cmb Block user comment: N Private report: N New Comment: > The only bug I can see here is that realpath() on a junction is > resolving it > […] > when last I knew PHP deliberately did not - only symlinks. Do > you agree? I just checked with PHP 5.3.29, and that already did resolve junctions. Anyhow, this ticket is actually a duplicate of bug #72738; I don't think it makes much sense to change this long standing behavior. > There was a specific reason why I said you can't symlink a > directory... but I don't remember what it was. Some sort of quirk, > maybe? Perhaps that you can't unlink() a directory symlink on Windows (you need to rmdir() there). Previous Comments: ------------------------------------------------------------------------ [2019-08-16 18:50:07] requinix@php.net @jbelli: There was a specific reason why I said you can't symlink a directory... but I don't remember what it was. Some sort of quirk, maybe? Regardless, right now the symlinked directory I just created is behaving as I expect, and mklink's /D isn't something new to Windows 10. ------------------------------------------------------------------------ [2019-08-16 18:38:16] jbelli at pobox dot com Windows does support symlinked directories. They can even be symlinks to UNC paths. Symlinked directories can be relative or absolute. C:\>mklink /? Creates a symbolic link. MKLINK [[/D] | [/H] | [/J]] Link Target /D Creates a directory symbolic link. Default is a file symbolic link. /H Creates a hard link instead of a symbolic link. /J Creates a Directory Junction. Link Specifies the new symbolic link name. Target Specifies the path (relative or absolute) that the new link refers to. ------------------------------------------------------------------------ [2019-02-19 21:40:13] requinix@php.net There is still a bug here, even if it wasn't the one you were expecting. > there is no cross-platform solution to create sym-link that can be later > recognized by PHP the same on different OS :( The problems come from Windows and NTFS restrictions. Specifically, Windows requires the SeCreateSymbolicLinkPrivilege privilege, which Administrator has but it can also be granted to other accounts. Windows also does not support symlinked directories. But it can do symlinked files and hardlinked/junctioned directories. Besides that, PHP is as cross-platform as it can be. ------------------------------------------------------------------------ [2019-02-19 21:29:13] mesaverde228 at gmail dot com I assume issue can be closed because for subfolders within "linked" directory exists another separate ticket ------------------------------------------------------------------------ [2019-02-19 21:21:15] mesaverde228 at gmail dot com yes, you are right. "ln" tool is not a solution for me :( and as I can see there is no cross-platform solution to create sym-link that can be later recognized by PHP the same on different OS :( ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=77639 -- Edit this bug report at https://bugs.php.net/bug.php?id=77639&edit=1

« previous php.bugs (#236737) next »