fix(relinker): detect output aliases with a filesystem probe outside Windows #6927
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6927"
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 jotitadev on 2026-10-16T19:29:17Z.
What
Follow-up from #4802 (listed there by the maintainer): fresh outputs that the volume treats as the same name are not detected outside Windows. The default macOS volume (APFS) is case-insensitive and normalization-insensitive, but the probe in
SameOutputDestinationand itsOutputIdentityDirectorywere under#ifdef _WIN32. On macOS, in an empty directory:returned 0 and left one file,
windows-diagnostics-imports.txt, holding the PE: the diagnostics were lost. The same happens with--executableoutputs namedÄ/ä,Ω/ω,Ж/жandéin NFC/NFD: one executable overwrites the other.Outside Windows, a text fold cannot match APFS (Unicode case and canonical equivalence), so this asks the filesystem instead: when two not-yet-existing outputs share a directory, it creates the first name inside an
OutputIdentityDirectorynext to them and checks whether the second name resolves to the same entry, then removes the probe. Case-sensitive volumes report distinct names. The Windows branch is unchanged, so this does not overlap with #6715 (CompareStringOrdinalunder_WIN32); the two merge cleanly.OutputIdentityDirectoryis now built on every host; the hard-link identity check inSameOutputFilestays Windows-only.test_output_collisions.pychecks the ASCII case-variant collision whenever the work directory is case-insensitive, not only on Windows, and adds a filesystem-probed alias test (A/a, Ä/ä, Ω/ω, Ж/ж, é NFC/NFD, and an Ä/a control) for Linux and Windows output formats. It skips on Windows, where #6715 covers the Unicode cases.Tested
Apple M2 Max, macOS 27.2, Apple clang, Release relinker-only build on
main5d9dcc42d:main); x86_64 under Rosetta with Python 3.9.6, 170/173, the same three failures asmain(pr_overlap_tools,release_package,linux_fixed_base).tools/check_conventions.py --base origin/mainpasses.output_collisionsfails withmain's relinker (exit 0, one output written for every alias pair) and passes with this change on arm64 and x86_64. All five alias pairs now fail with "Output paths collide" and leave no outputs; Ä/a still writes two outputs.hdiutil create -fs "Case-sensitive APFS",TMPDIRon it):output_collisions,secondary_output_collisions,input_preservationandrelinker_executablespass. A/a, Ä/ä, Ω/ω and Ж/ж produce two distinct outputs; é NFC/NFD is still reported as a collision, because APFS stays normalization-insensitive on case-sensitive volumes.46cafca20: no conflicts; the same four tests pass on macOS.Rebased onto
main1b1f8483c; the files this changes are unchanged since the tested base.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 simonbbby on 2026-10-17T00:23:39Z.
Independent native Linux coverage for the gap in Tested, plus an APFS before/after control, on exact head
0a8ec7d15a32f960a2b3d78a8f87136a211ff1ef.Built the real CLI in Release relinker-only mode on Ubuntu 24.04 x86-64 / GCC 13.3 and macOS 27.2 arm64 / AppleClang 21.0.0. The four focused CTests (
output_collisions,secondary_output_collisions,input_preservation,relinker_executables) pass on both hosts: 4/4 Linux, 4/4 Mac.Also ran a parent/fixed conversion matrix, using the synthetic ELF fixture and measuring the filesystem's identity behavior first. The parent control substitutes only the parent's
main.cppobject; all other production objects are identical. Each pair is tested for both ELF and PE output:Output paths collideand writes no output in all ten. Both distinct-name controls succeed with two separate valid outputs..anyps5-output-identity-*directory.No Linux casefold-enabled directory, case-sensitive APFS volume, Windows host, or converted guest execution was tested in this run. These are actual CLI/filesystem checks, not a modeled name comparison.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T13:55:06Z.
Checked the filesystem probe in
SameOutputDestination(non-Windows branch), its cleanup and the new alias test against the relinker CI on macOS (arm64 and x86_64), Linux and Windows, plus @simonbbby's independent Linux/macOS run; merged.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T13:58:57Z.
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.
core/relinker/main.cppcore/relinker/relinker/tests/test_output_collisions.py