Repository navigation
fix(libc): rename over a dangling symbolic link on macOS - #9911
oneandonlydean merged 1 commit into
Conversation
RenamePath compares source and destination with fs::equivalent and treats ENOENT from it as "not the same file". libc++ reports errc::not_supported instead when either path does not resolve, so on macOS renaming a file over a dangling symbolic link failed with EIO (guest_filesystem). A path that does not resolve cannot be the same file as the other, so not_supported is cleared the same way on macOS. The same guard is part of boykopovar#7201 and boykopovar#8658. Co-Authored-By: marion909 <103169397+marion909@users.noreply.github.com> Co-Authored-By: iamthehimansh <67262056+iamthehimansh@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The Windows relinker CI run on this head built successfully but CTest reported 234/235 passing; only |
|
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.
|
|
The macOS change is guarded at the |
|
Thanks. I can't rerun jobs here, so I reran the same Build workflow on my fork for the unchanged head AI-assisted: yes |
|
@MarcZX10 rerun of the relinker suite on head
run. So the earlier 120 s timeout looks load-related; this change doesn't touch the relinker or the conventions tooling. AI-assisted: yes |
harisibrar1
left a comment
There was a problem hiding this comment.
Checked against main 3875f8c, FreeBSD rename(2) and libc++ filesystem/operations.cpp (__equivalent):
- FreeBSD's rename doesn't follow the destination's final component, so replacing a dangling link is the expected result.
- libc++
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. - Optional nit: this is libc++ behaviour rather than Apple's, so
#ifdef _LIBCPP_VERSIONwould describe the guard more precisely. Fine as is for the macOS series. - The branch still merges cleanly with current main.
Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
Tested on Apple M1 Pro, macOS 27.0.1 (x86_64 build under Rosetta 2)Applied at
The later stop is a separate gap that this PR does not claim to fix. I found no open PR for it. AI-assisted: yes (Claude Code applied the PR, ran the tests and wrote this report). |
|
Thanks @maximilianfv. That later stop is in the series, not @harisibrar1 good point on AI-assisted: yes |
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(53db0ba,main3fd1cc3) 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 macOS support #1.ctest -j4: 1648 tests, 14 failed: the known macOS failures from my list on macOS support #1 minusguest_filesystemandguest_standard_streams(fix(libc): leave a stream that is reading untouched in fflush on macOS #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 feat(aot): consolidate native ARM64 compiler, runtime and consumers #5021, Macos port #7201 and feat(libkernel_sys): implement setlogin #9693 forRename.cpp; Macos port #7201 contains this change, feat(libkernel_sys): implement setlogin #9693 changesSourceLookupError_nid_no_patch, and feat(aot): consolidate native ARM64 compiler, runtime and consumers #5021's diff is too large for the API to compare. fix(libc): rename onto or from a Windows directory symbolic link like a link #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