fix(libc): rename over a dangling symbolic link on macOS #9911
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9911"
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 tkcm01 on 2026-10-22T21:25:07Z.
What
RenamePath_nid_no_patchcompares source and destination withfs::equivalentand clearsENOENTfrom it, so a destination that does not resolve counts as "not the same file". libc++ reportserrc::not_supportedinstead ofENOENTwhen either path does not resolve, so on macOSrenameof a file over a dangling symbolic link returnedEIO(5) instead of replacing the link.guest_filesystemstops there (GuestFilesystem.cpp:871onmain:rename_nid_postfix(replacement, dangling), "Filesystem check failed … (guest errno 5, host errno 5)").A path that does not resolve cannot be the same file as the other, so
not_supportedis cleared the same way, on macOS only. Linux and Windows are unchanged.The same guard is part of the macOS ports in #7201 (@marion909) and #8658 (@iamthehimansh), both credited as co-authors; this splits it out as a small change, as for the rest of the macOS series on #1.
Tested
macOS 27.0.1, Apple M4, Apple clang 21, x86-64 build under Rosetta 2, no Vulkan loader. The libraries do not link on macOS from
mainalone, so the run is on mugurc'sci/macos-series-2(53db0badb,main3fd1cc393) with #7524, the code commits of #7937 and the libSceSsl change from #7332, as described on #1.guest_filesystemaborts at the dangling-symlink rename with guest and host errno 5.sceKernelGetdentson a regular file (ENOTDIRinstead ofEINVAL), which is in the series' macOSsceKernelGetdirentries, not inmain; with that also mapped locally,guest_filesystempasses. I've reported that one on #1.ctest -j4: 1648 tests, 14 failed: the known macOS failures from my list on #1 minusguest_filesystemandguest_standard_streams(#8920 is in this tree), plusprecise_wait, which is flaky here (it failed in my first baseline run too). No new failure.python3 tools/check_conventions.py --base upstream/main: passed.tools/pr_overlap.pylists #5021, #7201 and #9693 forRename.cpp; #7201 contains this change, #9693 changesSourceLookupError_nid_no_patch, and #5021's diff is too large for the API to compare. #9661 changes the two lines above this hunk.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-23T03:21:03Z.
Review: APPROVED
Checked against main
3875f8c8ff, FreeBSD rename(2) and libc++filesystem/operations.cpp(__equivalent):equivalentreportserrc::not_supportedwhenever either path'sstatdoesn't give an existing file, which explains the EIO on main. Clearing it is safe here becausedestinationExistsalready comes fromsymlink_status, and any real failure surfaces from the actualrename.#ifdef _LIBCPP_VERSIONwould describe the guard more precisely. Fine as is for the macOS series.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.