As of Windows 1903, when the OneDrive on-demand feature is enabled, the
OneDrive folder is reported as reparse point by `FindFirstFile()`, but
trying to get information about the reparse point using
`DeviceIoControl()` fails with `ERROR_NOT_A_REPARSE_POINT`. We work
around this problem by falling back to `GetFileInformationByHandle()`
if that happens, but only if the reparse point is reported as cloud
reparse point, and only if PHP is running on Windows 1903 or later.
The patch has been developed in collaboration with ab@php.net.
We should keep an eye on the somewhat quirky OneDrive behavior, since
it might change again in a future Windows release.
Keep compatibility with 7.2 and below which better comply with
realpath(3). This might have been fixable another way, say by checking
of QueryDosDevice or alike, sadly that comes with a huge performance
impact. The new internal realpath API is kept available so is
usable when bind or network mount or other OS specific realpath
variants are needed. If not used by default, a userspace function for
this specific case might be considered to be offered in next minor.
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.
In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.
This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
The slower I/O as a traditional bottleneck on Windows which is
the target of this patch. The recursive path resolution, while being
an allround solution, is expensive when it comes to the common case.
Files with proper ACLs set can be resolved in one go by usage of specific
API. Those are available since Vista, so actually can be called old. Those
simpler api is used for the cases where no CWD_EXPAND is requested. For
the cases where ACLs are improper, the existing solution based on
FindFirstFile still does good job also partially providing quirks. Cases
involing reparse tags and other non local filesystems are also partially
server by new APIs.
The approach uses both APIs - the quick one for the common case still
integrating realpath cache, and the existing one as a fallback. The tests
show the I/O load drop on the realpath resolution part due to less
system calls for the sub part resolution of paths. In most case it is
justified, as the sub parts were otherwise cached or unused as well. The
realpath() implementation in ioutil is also closer to the POSIX.
This effectively allows a UNIX like semantics for deleting files
with an open handle. Some OS related limitations still persist,
but the Windows 95 times can be considered as definitely over.
Having `int` there is no real profit in the size or speed, while unsigned
improves security and overall integration. ZPP supplied strings can
be then accepted directly and structs can be still handled with smaller
unsigned types for size reasons, which is safe. Yet some related places
are to go.
basic move tsrm_realpath_r to size_t
fix conditions and sync with affected places
touch ocurrences of php_sys_readlink usage
follow up on phar path handling
remove duplicated check
move zend_resolve_path and related pieces to size_t
touch yet resolve path related places
remove cast
missing pieces
missing piece
yet cleanups for php_sys_readlink for ssize_t
fix wrong return