Repository navigation
fix(relinker): preserve patch inputs across all outputs - #8251
Conversation
|
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.
|
fogydes
left a comment
There was a problem hiding this comment.
Reviewed the diff, CI, and test logic.
Production code (main.cpp): The change consolidates patch-file collision detection into the shared checkOutputInputs lambda. Before this PR, only the manifest output checked for collision with the patch file (via std::filesystem::equivalent). Now, a single check — if (!args.noPatches && std::filesystem::is_regular_file(patchFile) && SameOutputFile(patchFile, path)) — runs for every generated output path (executables, registry, guest modules, desktop entry, manifest). The old 4-line equivalent() check is removed since SameOutputFile already handles direct paths, hard links, and symlinks.
The !args.noPatches guard correctly allows overwriting when patches are disabled (--no-patches), since in that case the file is treated as an ordinary input, not a patch configuration.
Test (test_patch_input_preservation.py): Thorough — tests:
- Control case: existing patch config is preserved after a successful run (no collision).
- Every output type × three alias forms (direct path, hard link, symlink): verifies exit code 2, "would overwrite the patch file" in stderr, patch config preserved, all inputs and previous outputs preserved, no
.anyps5-output-identity-*temp files left behind. - Symlink fallback on Windows when the privilege isn't available.
- Empty configuration rejection.
--no-patchesbypass (file is overwritten with ELF output, confirming the guard works).
Both Linux ELF and Windows PE output formats are covered via the windows bool.
CI: conventions, intake, labels all pass. Build/relinker tests not triggered (no relinker build check visible, but the conventions are the gating CI for non-build PRs).
PR body: Complete template, overlap analysis done (6 conflicting PRs checked manually), honest about no Windows or runtime testing.
No blocking issues found. Well-structured consolidation that reduces the collision-check code while covering more output paths.
|
Verdict: defect on Windows. Tested at The relinker exits 0, and The trigger is the
The cause is in Other results:
AI-assisted: yes (Claude Code); results above were run on this machine. |
|
Windows run of 029f867 merged onto
|
|
@imshah-id the change looks right to me on current One thing left before CI: @ycbuzi measured |
|
@imshah-id The Windows report for head 029f867 puts patch_input_preservation at 76 seconds, while core/relinker/CMakeLists.txt still gives it TIMEOUT 20. Please split or shrink the regression cases and report cold Windows timings on the final head. Current CONTRIBUTING.md requires each test to finish within 30 seconds on CI, including its first run, and asks to split or shrink rather than raise the timeout. Please keep direct-path, hard-link and symlink coverage, unchanged-input/output assertions, and the empty-config and --no-patches controls. |
|
A second Windows timing for the same head, as data for the timeout question. Head 029f867 merged into The run was So the 76 s seems specific to the reporting machine, and this test doesn't need that long on Windows in general. That doesn't remove the margin concern for slower CI runners. AI-assisted: yes (Claude Code) |
|
Static review plus an independent Linux run (CachyOS, kernel 7.2.10, GCC 16.2.1, Ninja, Release, What I checked (static)
Focused test run
Not covered (honest) This test is exercised on Linux here only. Windows/macOS alias variants (hardlink/symlink privilege handling on Windows, hardlink semantics on macOS) are in the matrix but were not run on those hosts in this triage environment; the Windows symlink case self-skips with a message when privilege is unavailable. |
|
@imshah-id Thanks to @BKlaasWerkman for the fresh-build Windows timing: 7.3 seconds under the existing 20-second CTest timeout is useful evidence that the test does not time out on every Windows host. The earlier 76-second direct run on another Windows host is still unexplained, and the branch has not changed since the request to split or shrink the regression. Please reduce the repeated work while keeping direct-path, hard-link and symlink preservation checks, plus empty-config and --no-patches controls, then report the final-head cold Windows CTest time. A larger timeout would not address the current under-30-second test rule. The Linux pass is helpful correctness evidence, but does not settle Windows duration or symlink-privilege coverage. |
029f867 to
062bee7
Compare
What
Passing an existing patch configuration as an executable, registry, module, icon or other generated output lets the relinker overwrite that configuration. Only the patch-manifest output previously checked for this collision.
Move patch-file protection into the shared output/input validation, before any output is written. Reuse
SameOutputFileso direct paths, hard links and symbolic links are covered. Protect empty configurations too;--no-patchescontinues to allow overwriting an ignored configuration.Add a regression covering generated output paths for Linux and Windows formats, verifying that rejection preserves every existing output and input. Include distinct-path success, empty-configuration rejection and disabled-patch controls.
The regression now checks each output kind once per format, distributes direct-path, hard-link and symlink cases across outputs, and retains all three aliases for the primary executable (including the Windows
.exesymlink). This reduces relinker invocations from 91 to 37 while retaining all 29 output-kind/format pairs, unchanged-input/output assertions, empty-config rejection and--no-patchescontrols. Windows hosts without symlink privilege fall back to a direct-path check for that output, and report the missing symlink coverage. Linux-format, Windows-format and control cases have separate CTests with the existing 20-second timeout.Tested
macOS, Apple Silicon, AppleClang 21.0.0, Release relinker-only build. Rebased onto
f2d874c1fdccf781c0fa5d86619bb5dd8894b958; final head062bee70effe50cada7a80505bfc6721c5c9bad7.-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON; all 549 CTests passed (87.87 seconds). After the final symlink-privilege fallback adjustment, all three focused CTests passed again.python3 tools/check_conventions.py --base upstream/mainandgit diff --checkpassed. Graph output remains untracked.gh workflow run build.yml --repo boykopovar/AnyPS5 --ref main -f pr=8251 -f full=false, then report first-run timings forpatch_input_preservation_*and any symlink privilege fallback. Fork Actions are enabled, but the existing manual workflow requires an open PR in the same repository and cannot directly validate upstream PR 8251 from the fork.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)