fix(libc): follow a Windows symbolic link in access #9474
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9474"
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 Gruzzberry on 2026-10-21T22:59:05Z.
What
On Windows,
accessread the attributes and the security descriptor of a symbolic link itself, not of its target: a dangling link passedF_OKandR_OK, a link to a read-only file passedW_OK, and a link to itself passedF_OK. FreeBSD 11.4'skern_accessatlooks the path up withFOLLOW, so the target decides:ENOENTfor a missing target,ELOOPfor a loop, and the target's permissions.When the resolved path is a reparse point,
accessnow opens it withoutFILE_FLAG_OPEN_REPARSE_POINT(so Windows follows the link), takes the target's path withGetFinalPathNameByHandleW, and checks that path as before. A failed open goes through the existing error mapping, withERROR_CANT_RESOLVE_FILENAMEasELOOP(62), as the gueststatmaps it. Paths that are not reparse points take the same calls as onmain. Linux already follows links in the hostaccessand is unchanged.Tested
Windows 11 (10.0.26200), WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
-DBUILD_TESTING=ON, onmaind6eafa54d0(rebased), Developer Mode on so links can be created.guest_access: new checks with a dangling link (F_OKandR_OKfail withENOENT), a link to itself (ELOOP), and a link tosample.txt(R_OK|W_OKpasses; with the target read-onlyR_OKpasses andW_OKfails withEACCES; with only the link read-onlyW_OKpasses). The links are removed afterwards; without link permission the checks are skipped with a message. Onmainthe test fails at the first new check (accesson the dangling link returns 0); with this PR it passes.guest_filesystem,guest_path_case,guest_path_name_length,guest_appcontent(other callers ofaccess): pass.maind6eafa54d0and onmainwith #9442, #9469, #9474, #9487 and #9496 merged together, same machine: 1890 tests each, identical results (1869 passed, 18 skipped; on both, the 3agc_driver_sample_order*tests fail andagc_driver_image_array_window_past_layer_limitis not built, as its 64 KiBalignasis rejected by this MinGW toolchain).python tools/check_conventions.py --base upstream/main: passes.std::filesystem::create_symlink), a console, a title run.Overlaps
access_nid_postfix. The two compose: its archive branch returns before the host checks, and this PR only changes the host checks after it (FollowedPathon the resolved path, the target for the attributes and the security descriptor). Either order works; whichever lands second rebases and keeps both, then rerunsguest_accessand #7447's archiveaccesschecks. Asked on #7447.tools/pr_overlap.py --branchon the rebased head lists no direct overlap; the 2 pull requests it could not compare are #7447 (above) and #6044 (below).GuestAccess.cpptotests/files/; if it lands first, the new cases move with the file in the rebase.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); no silent stubs added.mdfiles or images added to the repositoryAI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T23:00:49Z.
The access change also edits the same
access_nid_postfixregion as #7447, which adds archive-aware access lookup. These changes address separate cases, but both need to compose at that function and may not apply cleanly if either lands first. Please coordinate the merge order with #7447’s author and updateDepends onif one PR must land before the other; after rebasing, verify both symlink-target access and archive-entry access still pass.Imported from boykopovar/AnyPS5. Originally posted by Gruzzberry on 2026-10-21T23:14:07Z.
Full suite with this PR merged together with #9442, #9469, #9474 and #9487, against
mainon the same Windows 11 machine (MinGW-w64 GCC 15.2.0 r7, Release): 1875 tests, the same results exceptagc_import_settle_first_use, which also skips onmainwhen its copies finish before the import returns (5 of 5 runs).Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:31:12Z.
Review: DISMISSED
The Windows symlink handling and tests cover the relevant semantics: following targets for
F_OK/R_OK/W_OK, missing targets, loops, target permissions and link-only attributes; the non-link path is unchanged. The PR itself says #7447 also editsaccess_nid_postfixfor archive paths, but no author-agreed order is recorded. Please coordinate with #7447’s author, document the order/Depends on relationship, and preserve both archive lookup and symlink following in the combined function. This branch and test report are based ona6dcea927, while upstream main isab347d144d. Please rebase and rerunguest_access, the listed filesystem callers, conventions and current overlap checks. Hosted product jobs are skipped; I did not run local tests.Imported from boykopovar/AnyPS5. Originally posted by Gruzzberry on 2026-10-22T06:49:02Z.
Rebased onto
maind6eafa54d0.guest_access,guest_filesystem,guest_path_case,guest_path_name_lengthandguest_appcontentpass on the new head, the new checks fail on thatmainwithout the change, andcheck_conventions.pypasses. Full suite onmaind6eafa54d0and onmainwith #9442, #9469, #9474, #9487 and #9496 merged together: 1890 tests each, identical results.On #7447: I asked its author on #7447. The two compose, as its archive branch returns before the host checks this PR changes, so either order works; whichever lands second keeps both and reruns
guest_accessand the archiveaccesschecks. The description records this under Overlaps.Imported from boykopovar/AnyPS5. Originally posted by Gruzzberry on 2026-10-22T11:40:58Z.
Holding this as a draft, following the direction on #5239: the open queue is above 700 and no named title needs this change on current
main. I will only mark it ready again with a current-main title ID, its Game bring-up discussion and the log line where it stops on this, or once the queue is below 700. Thanks for the reviews so far; the requested fixes are being made on the branch in the meantime.