fix(libkernel): fail chflags through a dangling Windows symbolic link with ENOENT #9469
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9469"
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:52:47Z.
What
On Windows,
chflagssucceeded on a symbolic link whose target is missing and faileddangling/withENOTDIR. FreeBSD 11.4'skern_chflagsatlooks the path up withFOLLOW, so both fail withENOENT.The cause is the lookup in
LookupError: under MinGW,std::filesystem::statusdoes not follow a Windows symbolic link and reports a dangling link as an existing regular file. When the last component (or the one before a trailing slash) is a reparse point, the lookup now goes through the target withFile::TryFillFileStat, the gueststat, which already follows links: a missing target givesENOENT, a link to a file followed by a slash givesENOTDIR, a link to a directory is accepted. Linux is unchanged;chflagsis the only caller ofLookupError.Measured on
mainwith a standalone probe, the same dangling link:stat,truncate,utimesandopenalready fail withENOENT;chflagsreturned 0.Tested
Windows 11 (10.0.26200), WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release,
-DBUILD_TESTING=ON, onmain938812df1(rebased; since #9109,chflags("dangling/")fails withENOTDIRfrom the trailing-slash check before this lookup runs, so that check was dropped from the test; FreeBSD givesENOENTthere), Developer Mode on so links can be created.guest_filesystem: new checks on a dangling link (ENOENT) and a link to a file (0,ENOTDIRwith a trailing slash,EOPNOTSUPPfor an unknown flag), then both links are removed withunlink. Onmainthe test fails at the first new check (chflagson the dangling link returns 0); with this PR it passes. Without link permission the link checks are skipped with a message.guest_kernel_sys: passes.main938812df1and onmainwith #9442, #9469, #9474, #9487, #9496, #9661 and #9682 merged together, same machine: 2029 tests each; on both, the 3agc_driver_sample_order*tests fail andagc_driver_image_array_window_past_layer_limitis not built (its 64 KiBalignasis rejected by this MinGW toolchain). In the parallel run (ctest -j 12) one other test failed on the merged branch (guest_memoryin one run,guest_kqueuein another,agc_driver_shutdown_threads_queued_prebuildsin both); each passes alone, three runs out of three.python tools/check_conventions.py --base upstream/main: passes.std::filesystem::create_symlinkthere), a console, a title run.#9442 (
lchflags) is independent of this PR; its dangling-link check passes with or without it.Overlaps
tools/pr_overlap.py --branchon the rebased head lists no direct overlap; of the 12 pull requests it could not compare, none changesLookupErrororchflags. #9423 edits the start ofchflags_nid_postfix, notLookupError.GuestFilesystem.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:06:24Z.
Review: APPROVED
Reviewed the Windows-only lookup path and focused symlink tests. For reparse-point inputs the change follows the target through the existing guest stat helper, preserving
ENOENTfor a dangling target and checking directory type for trailing separators; the non-reparse path is unchanged. The debt note and limitations are explicit. Conventions, intake, eligibility, labels, and report pass; hosted Windows/Linux build and test jobs were skipped. The Windows 11 focused runs described in the PR are author-reported; I did not run them locally.Imported from boykopovar/AnyPS5. Originally posted by Gruzzberry on 2026-10-21T23:14:06Z.
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:33:08Z.
Review: DISMISSED
The Windows-only path and focused symlink cases were reviewed previously, and the reported combined Windows run is useful. The tested commit and the current branch base are still 47 upstream commits behind current main (now
110a18ba01); the reported baseline isa6dcea927. Please rebase/update onto current main and rerun the focusedguest_filesystemchecks plus the relevant conventions and overlap checks on that base before treating the earlier results as current. I checked the overlap bot warnings: the listed Stdio.cpp PRs touch other areas, and #6044 does not list GuestFilesystem.cpp, so I found no direct conflict in those warnings. No local test was run for this follow-up.Imported from boykopovar/AnyPS5. Originally posted by Gruzzberry on 2026-10-22T06:49:01Z.
Rebased onto
maind6eafa54d0.guest_filesystemandguest_kernel_syspass 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. The overlap scan of the rebased head and a manual check of the pull requests it could not compare are in the description under Overlaps.Imported from boykopovar/AnyPS5. Originally posted by Gruzzberry on 2026-10-22T11:40:55Z.
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.