fix(relinker): reject FIFO output paths before writing #18341
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18341"
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 Lopalp on 2026-11-11T10:22:39Z.
What
On POSIX hosts, a valid conversion blocks indefinitely when an output path is an existing FIFO with no reader. This also affects symlinks to FIFOs and registry/needed-library sidecars: the executable can already have been overwritten before writing the sidecar blocks.
Check the complete list of planned output paths for FIFOs before the first output write and report the offending path. The check follows symlinks. It applies to ELF, PE and Mach-O output. Dry runs remain non-writing, and the shared FileWriter is unchanged.
Add three POSIX regression tests covering all output formats. Each checks direct and symlinked FIFOs, registry and needed-library FIFO destinations, preservation of existing executable/metadata files on rejection, and successful creation/replacement of regular files and symlinks to regular files.
Tested
macOS 27.0.1, arm64, AppleClang 17.0.0, Release, relinker-only; base
71ce4789567dfd2c7c4e64779365ea35f8d14174.output_fifo_*CTests passed, along with the existing input preservation, output collision, input-file and dry-run tests (11/11 focused CTests).python3 tools/check_conventions.py --base origin/mainandgit diff --check origin/main: passed.tools/pr_overlap.py --branch investigate/relinker-nonregular-output --repo boykopovar/AnyPS5scanned 1,982 open PRs. The final check reported no confirmed conflicting lines, duplicate exports or new files. It exited 2 because 16 other PRs already conflict with main. I manually compared their changes in the shared files: none changes the output-validation loop or the test-registration location used here. The CMake addition also applies unchanged to 13 of those heads; the other three lack surrounding dry-run registrations from newer main but change unrelated CMake blocks.The output formats were generated on macOS; this is not a native Windows/Linux runtime or game-start claim.
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)Manual overlap comparisons for PRs already conflicting with main
Compared the branch changes from each PR's merge base in
core/relinker/CMakeLists.txt: #5021, #6149, #10792, #10861, #11628, #11661, #11689, #11698, #12678, #13486, #13716, #15245, #15642, #15896, #17451 and #17473. Also comparedcore/relinker/main.cppfor #12678 and #15245; both only pass additional conversion options inConvert, outside the output-validation loop.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-12T15:54:34Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
The diff adds a FIFO check to the relinker's output-validation loop and three POSIX regression tests, and the code I read shows no defect.
What I ran
Head
01745f2cd9be6a76ed0ded2aac29c3821d9c8b9f, basemain. No build and no test was run. The review is by readingdiff.patchand the head code through the reader.Results
Findings
Blocking
None.
Non-blocking
core/relinker/main.cpp:433:std::filesystem::is_fifois called without an error code. If the stat fails for a reason other than "not found", it throwsstd::filesystem_error, which reaches the genericstd::exceptionhandler instead of theRelinkerExceptionmessage. I did not verify the exact behaviour for this case.core/relinker/main.cpp:433: the check runs before any write, but a FIFO created after the check and before the write would still block. The window is small.Not verified
--macosflag name used by theoutput_fifo_macostest was not confirmed in the head code.std::filesystemerror behaviour described above was not checked.files.jsonwas not read.manifest.jsonlists the three changed files as included. Their full texts underfiles/were not read; the changes were read fromdiff.patch, and head context only forcore/relinker/main.cpp.To get this to a good state
Nothing is required.