fix(libkernel): support lstat on long Windows paths #7202
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7202"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T16:12:24Z.
What
Prepare native Windows stat paths with the extended-length namespace before the
lstatmetadata calls. Add a Windows filesystem regression that creates a host file under a path longer thanMAX_PATH, verifies guestlstatreports the regular file and its size through both ordinary and already-extended host aliases, and verifies missing long paths still reportENOENT.Tested
NativeStat.cppandGuestFilesystem.cpp.665e4cf540,git diff --check upstream/main...HEADandpython3 tools/check_conventions.py --base upstream/main --head HEADpass. An independent MinGW syntax-only check passes forNativeStat.cpp; theGuestFilesystem.cppattempt was blocked by the installed headers (_fflush_nolockandFILE_CS_FLAG_CASE_SENSITIVE_DIRare undeclared).python3 tools/check_conventions.py --base upstream/mainandgit diff --checkpassed.pr_overlap.pyreports shared files with #6897, #6992, #7111, #7196 and #7201; manual review found no duplicate long-pathlstatimplementation. #7196 handlessceKernelStat, #6992 handles symlink-loop errors, #7111 adds absolute-link support, and #7201 changes Apple-only timestamp fields. #7111 has merged; this branch is now rebased onto upstream/main ate7e3e9c1984c293f06bff08428b8c89b7b932ac2, preserving the compatibleDoLstatchange.Checklist
main; no other open PR implements long-pathlstatsupportNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T16:21:46Z.
Thanks, this looks good in review. One note on ordering: we plan to merge #7196 first. After it lands, this PR will need a small rebase. The only conflict is the test in
core/libs/tests/GuestFilesystem.cpp; production code merges cleanly. We'll run full CI on the rebased head.Non-blocking, for a later follow-up if you're interested: with #7187, #7196 and this PR there are now three copies of the
\\?\path-preparation helper. A single shared helper would keep them from drifting.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T16:57:19Z.
Yes, a shared helper is a useful follow-up. These three PRs have separate filesystem call sites, and keeping their current changes focused avoids adding cross-PR conflicts while their fixes are reviewed and rebased. After #7187, #7196 and #7202 land, I can map the common path-normalization rules and propose one internal helper with shared tests, preserving each call site’s existing error behavior.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T23:56:53Z.
Rebased onto current main
bd5856170. TheGuestFilesystem.cppconflict came from #6992 adding its long-pathstatcoverage; I combined the cases so the Windows test now covers bothstatandlstatthrough ordinary and already-extended paths, including missing-path errors. The long-path preparation and symlink-loop errno mapping are separate behaviors; #7111/#7273 change which reparse-point typeslstatrecognizes, while this change prepares the path used by those lookups.check_conventions.py --base upstream/main,git diff --check, and MinGW C++20 syntax checks ofNativeStat.cppandGuestFilesystem.cpppass. Full CMake configuration could not run in this worktree because its SDL2 submodule is absent; no hosted checks have reported yet on the rebased head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T23:57:38Z.
CI update for rebased head
946c44103: eligibility, conventions, and report checks have passed. Windows and broader platform build/test jobs are skipped by the repository path filters, so the MinGW syntax checks remain the Windows compile evidence for this update.Imported from boykopovar/AnyPS5. Originally posted by Bonjourcestmatt on 2026-10-18T05:43:33Z.
Independent Windows run, since the PR description says the Windows runtime regression could not be run on Linux.
Setup: Windows 11 (MinGW64, native), WinLibs GCC 15.2.0 UCRT,
origin/main66e71b63dwith this PR head bbec884ce merged.guest_filesystem(3 runs each)mainNativeStat.cpp + this PR's testlstat_nid_postfixcheck on the path longer than MAX_PATHguest_posix_filesystemwith this PRSo the new regression does fail without the
NativeStat.cppchange on Windows and passes with it.Not checked: the full non-GPU suite, Linux, macOS, and the
stat/sceKernelStatpaths (covered by other PRs).Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T05:45:28Z.
Thanks for running the Windows regression independently. Your three repeated runs confirm that the long-path
lstatcase fails without the change and passes with it, and thatguest_posix_filesystemremains green. I have added this platform validation to my review notes.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T12:15:34Z.
Rebased onto current
mainat0d078f75dand pushed6b3486eed. I resolved theNativeStat.cppconflict by keeping the current symlink and junction handling while passing the prepared extended path to each Windows API call.git diff --check upstream/main...HEADandpython3 tools/check_conventions.py --base upstream/mainpass. I could not run the Windows-only path regression locally on this Linux host; the updated PR checks are pending.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T12:44:44Z.
Rebased #7202 onto current
mainafter #7196 merged; the branch now includes the additional long-pathlstatchanges and tests fromNativeStat.cpp/GuestFilesystem.cpp. The updated commits retainMarcZX100as author.git diff --checkpasses, and the local Linux configure/build completed. This checkout exposes noguest_filesystemtarget on Linux, so I could not rerun the Windows-only regression here. The independent Windows run above passedguest_filesystem3/3 andguest_posix_filesystem3/3 on the prior implementation; hosted checks are running for this rebased head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T12:45:30Z.
Hosted checks for rebased head
d815a192: eligibility, conventions, and report all pass. The Linux and Windows build jobs were skipped by path filtering for this Windows-only change. The independent Windows run above remains the runtime validation:guest_filesystemandguest_posix_filesystemeach passed 3/3 after the implementation change.Imported from boykopovar/AnyPS5. Originally posted by ycbuzi on 2026-10-20T15:57:35Z.
A heads-up from the #8534 side, since the overlap bot pairs the two: #8534 adds
IsNameSurrogate(p, "lstat")toDoLstat, and when the two are merged git keeps that line on the raw path without a conflict marker. With this PR's long-path preparation everywhere else, a reparse point beyondMAX_PATHthen throwsstd::system_errorfrom that call (lstat: CreateFileW: The system cannot find the path specified). The fix is to passpreparedthere and toRead/ReadJunction, which is what I measured passing on Windows (main4036fab1b+ this PR + #8534:guest_filesystem,guest_kernel_sys,guest_posix_filesystem, plus a long-path name-surrogate case in your long-path block). If this one lands first I'll do that rebase on #8534; if #8534 lands first, the same one-line change applies here. Details on #8534.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-20T19:49:34Z.
Thanks, that composition issue is real. After #8534's
IsNameSurrogatecheck is combined with #7202, it must receive the prepared extended path, and the subsequentRead/ReadJunctioncalls need that same path as well. I have not changed #7202 yet becauseIsNameSurrogateis introduced by #8534 and is not on this PR's base. If #8534 lands first, I will rebase #7202 and update all three calls with the prepared path; if #7202 lands first, please carry the preparation into #8534'sDoLstat. The long-path name-surrogate case you measured is the right regression to keep in the combined change.