fix(libkernel): detect Windows reparse points in lstat #2898
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2898"
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-10T18:07:58Z.
What
Detect Windows filesystem reparse points with
GetFileAttributesWbeforelstatfalls through to_wstat64. This preserves the existing unsupported-link exception instead of reporting a symlink as its target. Extendguest_filesystemon Windows to check file, directory, and dangling symlinks, including the exact exception text, unchanged guest errno, and untouchedFileStatoutput.Fixes #2886.
Tested
guest_filesystem_tests;guest_filesystempassed once and 5 repeated runs. The Windows-only symlink assertions are not exercised on Linux.GetFileAttributesWapproach: full library build and the expanded test passed 5/5, and the test failed 5/5 without the guard. This environment does not have a Windows host or MinGW cross-compiler.python3 tools/check_conventions.py --base upstream/mainandgit diff --checkpassed.Checklist
main; live searches found no open PR for this issue orlstatImported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-10T20:03:23Z.
Windows validation of the current head
cd60e955merged ontomain43e1425b.Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
BUILD_TESTING=ON, Developer Mode enabled, full build including thelibstarget.The new test does not compile on Windows:
missingNameis astd::string(line 187), so itsc_str()is narrow.std::filesystem::path(missingName).c_str()compiles.With that fixed, the test fails at line 366 (
remove_nid_postfix(root), guest errno 66ENOTEMPTY):target-directorycreated at line 225 is never removed. Addingstd::filesystem::remove(targetDirectory)to the cleanupRequireat line 243 fixes it.With both changes applied locally:
guest_filesystempasses 5/5 (--repeat until-fail:5).ctest -E "^agc_|video_out"passes 383/383.main'sNativeStat.cppand this test,guest_filesystemfails at line 249 (the file-link check), so the coverage detects the previous behaviour.Validation run with Claude Code assistance.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T20:15:06Z.
Thanks for testing this on Windows and catching both fixture problems. I updated the test to keep the missing target as a
std::filesystem::pathforCreateSymbolicLinkW, while retaining its narrow name for the guest libc calls, and addedtargetDirectoryto cleanup.The updated branch is rebased onto current
main. I rebuiltguest_filesystem_testson Linux and ranguest_filesystemfive times; all five passed. Your Windows 11 run validates the two fixes on the Windows toolchain. The separate macOS Intelwrite_watch_threadstimeout remains visible in the existing CI run and is unrelated to this filesystem change; I’m investigating it separately.Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-10T20:26:26Z.
Rerun on the updated head
a22206bfmerged ontomain56fb1b3b, same Windows 11 / WinLibs GCC 15.2.0 r7 / Release setup with Developer Mode: the test compiles unchanged,guest_filesystempasses 5/5 (--repeat until-fail:5) andctest -E "^agc_|video_out"passes 388/388.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T23:13:23Z.
Checked the diff, the
guest_filesystemtest (passes in the scoped Linux build and ctest) and @screamm's Windows 11 / MinGW GCC 15.2 run ona22206bf(test compiles, passes 5/5, full ctest 388/388). The Windows-only assertions don't run on Linux; merging on that evidence. Note that any reparse point (junctions, cloud placeholders) now throws the same unsupported-link exception rather than being stat'ed.