test(libkernel_sys): remove created symlinks before cleaning up on Windows #17894
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/17894"
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 JJenkx on 2026-11-09T21:01:55Z.
What
On Windows,
guest_kernel_sys_paths_symlinkatandguest_kernel_sys_paths_symlinkat_patchedtime out (20 s) every time onmain.symlinkatitself works. The hang is in the test's cleanup.The test deletes the link target
dataand then callsstd::filesystem::remove_all(root)whilelinkstill points at it. With MinGW's libstdc++,symlink_statusfollows the link, so a dangling symlink looks absent. It's never removed, andremove_allretries the same entry forever. Under gdb,CreateFileWis called on<root>\linkmore than 140,000 times in 60 s. A standalone program that only callsstd::filesystem::remove_all(dir, ec)on a directory holding one dangling symlink never returns either, built with WinLibs GCC 15.2.0.On Windows the test now deletes every reparse-point entry under its directory first, with
DeleteFileW, orRemoveDirectoryWfor directory links. It finds them throughGetFileAttributesW, which doesn't follow links, and then callsremove_allas before. Other hosts are unchanged. Library code is unchanged.Limitation:
std::filesystem::recursive_directory_iteratorwould still descend into a directory symlink on MinGW, sinceis_symlinkalways reports false there. This test only creates file symlinks.Found by a full Windows sweep of
main7259cce111after #9161 merged; details on #9161.Tested
Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release, head
47fcf68f61onmainf439f7f3a0, non-admin user with symlink creation available:guest_kernel_sys_paths_*tests pass in 3 of 3 runs, none skipped:statfs,symlinkat,symlinkat_errorsandfutimesat, each with its_patchedvariant.anyps5-kernel-sys-paths-*directory is left behind afterwards.main, bothsymlinkattests time out in a full sweep and when rerun alone.Not run on Linux or macOS; the change is inside
#ifdef _WIN32.Checklist
main; no other open PR implements the same functionsNotImplemented_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)