Skip to content

fix(relinker): reject an existing directory at any output path before writing - #11084

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
roboterspinne:fix/relinker-output-directory-paths
Oct 27, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
roboterspinne:fix/relinker-output-directory-paths

Conversation

@roboterspinne

Copy link
Copy Markdown
Contributor

What

Only the main executable output is checked for being an existing directory before anything is written (main.cpp:276, from #5359). A directory at any other output path passes every check in checkOutputInputs, whose only early return is for a path that does not exist, and fails only when FileWriter (Cannot open output file) or the desktop entry writer (Failed to write icon, Failed to write desktop entry) opens it. On untouched 4017310, 13 of the 15 cases in the new test exited 2 after writing earlier outputs: for example a directory at output.registry.json left output.elf and app0/sce_module/sample.prx.guest.prx, and a directory at output.elf.desktop left those plus output.elf.png and the four registry and needed-library files.

Tested

Windows 11, GCC 15.2.0 (WinLibs UCRT), relinker-only Release build (-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON); synthetic fixtures only, no title or homebrew.

  • Rebased onto 3a2c51a (no relinker changes since 4017310). Counter-check, run on untouched 4017310: output_collisions with the new cases on untouched 4017310 fails at the first case with AssertionError: (False, 'module', 2, ..., 'FAIL: Cannot open output file: ...\app0/sce_module\sample.prx.guest.prx\n'). Running all 15 cases one by one on untouched code: every case exited 2 with Cannot open output file, Failed to write icon or Failed to write desktop entry; Linux guest module and Windows diagnostics wrote nothing, the other 13 left between 1 and 7 output files. With the change all 15 exit 2 with <kind> output is a directory and write nothing; output_collisions passes in 7.7 s.
  • ctest -R '^(output_collisions|secondary_output_collisions|input_preservation|linux_desktop_entry_output|relinker_executables|game_patches|guest_registry|call_registry)$' -j 3: 8 tests passed in 12.1 s (output_collisions 8.5 s, secondary_output_collisions 8.7 s, input_preservation 6.8 s, call_registry 3.5 s, relinker_executables 1.9 s, game_patches 1.3 s, guest_registry 1.0 s, linux_desktop_entry_output 0.3 s) on 4017310. After the rebase onto 3a2c51a, ctest -R 'output|cli_args|relinker_conversion|desktop|registry|diagnostics' -j 3: 16 tests passed in 19.1 s (output_collisions 11.8 s, secondary_output_collisions 12.0 s, call_registry 6.4 s, cli_args 0.2 s, relinker_conversion 0.5 s, linux_desktop_entry_output 0.4 s, guest_registry 1.2 s).
  • Full suite: ctest --test-dir build-relinker -j 4 on 3a2c51a: 292 tests, 289 passed, long_paths skipped; failures known on this machine on main as well: select_tests (Windows symlink fixture), patch_advisor_unit (path with spaces, fixed by test(tools): compare quoted and resolved paths in the patch advisor test #10667); both failed again when rerun alone. No timeouts
  • python tools/check_conventions.py --base upstream/main with this title and description passed.
  • Not tested on Linux or macOS; CI runs the tests on all three hosts.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code)

… writing

Only the main executable output was checked for being a directory. A
directory at a guest module, extra executable, registry, needed-library,
patch manifest, icon, desktop entry or diagnostics path failed only when
it was opened, in most cases after earlier outputs had been written.
checkOutputInputs now rejects an existing directory for every output
kind it checks, as 286cf28 did for the main executable. Such runs
still exit 2, now before any output is written.
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

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.

Pull request Shared files not compared
PR 3786 docs/user/USAGE.md
PR 5021 docs/user/USAGE.md
PR 5925 docs/user/USAGE.md
PR 6171 docs/user/USAGE.md
PR 6924 docs/user/USAGE.md
PR 7642 docs/user/USAGE.md
PR 9345 docs/user/USAGE.md
PR 9508 docs/user/USAGE.md
PR 10043 docs/user/USAGE.md
PR 10193 docs/user/USAGE.md

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the output-path preflight and regression cases at this exact head. The directory check runs through the existing all-output validation before any output writes; the cases verify exit status, diagnostic, and unchanged tree for Linux and Windows output variants. I independently built the relinker-only target with GCC 12.2 and ran ctest --test-dir build-review -R '^output_collisions$' --output-on-failure; it passed 1/1. Hosted eligibility, conventions, intake, and the Linux, Windows, macOS ARM, macOS x86_64 and ASan relinker checks pass. Product/library build jobs are skipped by path policy.

@oneandonlydean oneandonlydean self-assigned this Oct 26, 2026
@oneandonlydean
oneandonlydean merged commit 5700026 into boykopovar:main Oct 27, 2026
13 checks passed
@roboterspinne
roboterspinne deleted the fix/relinker-output-directory-paths branch October 27, 2026 08:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants