Repository navigation
fix(libc): follow a Windows symbolic link in access - #9474
Conversation
|
The access change also edits the same |
|
Full suite with this PR merged together with #9442, #9469, #9474 and #9487, against |
MarcZX10
left a comment
There was a problem hiding this comment.
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 edits access_nid_postfix for 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 on a6dcea9, while upstream main is ab347d1. Please rebase and rerun guest_access, the listed filesystem callers, conventions and current overlap checks. Hosted product jobs are skipped; I did not run local tests.
1959fc9 to
17b707d
Compare
|
Rebased onto 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 |
|
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 |
access read the attributes and the security descriptor of the link itself on Windows, so a dangling link passed F_OK and R_OK and a link to a read-only file passed W_OK. A reparse point is now opened through its target and the target's path is checked, as FreeBSD 11.4's kern_accessat looks the path up with FOLLOW: a missing target fails with ENOENT and a link loop with ELOOP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
17b707d to
3e96c13
Compare
|
Rebased onto |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.
|
Checked the |
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, onmaind6eafa5 (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.maind6eafa5 and onmainwith feat(libkernel_sys): implement lchflags #9442, fix(libkernel): fail chflags through a dangling Windows symbolic link with ENOENT #9469, fix(libc): follow a Windows symbolic link in access #9474, fix(libkernel): follow a Windows symbolic link in chmod #9487 and fix(libkernel): fail open with O_CREAT and O_EXCL on a Windows symbolic link #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 feat(libc): support archive-backed stdio reads #7447's archiveaccesschecks. Asked on feat(libc): support archive-backed stdio reads #7447.tools/pr_overlap.py --branchon the rebased head lists no direct overlap; the 2 pull requests it could not compare are feat(libc): support archive-backed stdio reads #7447 (above) and test: organize library tests and label CTest suites #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