Skip to content

fix(relinker): reject output files needed as directories - #21078

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
TL-WN:codex/reject-output-directory-collisions
Nov 25, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
TL-WN:codex/reject-output-directory-collisions

Conversation

@TL-WN

@TL-WN TL-WN commented Nov 15, 2026

Copy link
Copy Markdown

What

Reject a conversion when a planned output file is also a directory needed by another output. With bundled modules and app0 as the output filename, the relinker previously wrote the modules under app0 and then failed to write the executable. Preflight now reports the collision before writing. --dry-run reports the same collision.

The overlap tool flagged four branches that conflict with main. I manually compared the shared files in #12678 and #15245 (conversion options) and #17557 and #17558 (hook-table output and test fixtures). The comparison confirmed that the collision check and regression are independent of those changes.

Tested

  • Ubuntu 24.04 on WSL2, GCC 13.3, Release relinker-only build. All 933 CTests passed on the rebased commit.
  • Reproduced with a synthetic bundled module for Linux and Windows output. On base commit 8d2cc51, dry run succeeds and conversion leaves a partial output tree. With the fix, both commands exit with code 2, report the collision, and preserve the original tree.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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

Reject conflicts between a planned output file and a directory needed by another output during preflight. Writing the executable to a new app0 path previously left converted modules behind before failing.

Cover Linux and Windows output in write and dry-run modes with synthetic guest modules.

@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 — looks good

Nothing in the inspected changes blocks merging; the new preflight rejects file-versus-directory output collisions before writing, and the regression covers dry-run and conversion cases on both output platforms.

What I ran

Reviewed head af1e7a2a6423d243c332d1b433709c2abe082083. I did not run commands or tests; repo_read.py was unavailable as a command in this review interface. I read the prepared description, commits, manifest, diff, and README, plus the changed lines and relevant surrounding code at the pinned head.

Results

Check Result Note
Code review passed Changed logic and regression inspected
Build and tests not run No local command execution available

Findings

Blocking

None.

Non-blocking

None.

Not verified

No build, test, or runtime checks were performed. The author reports 933 CTests passed on a rebased commit and describes synthetic Linux and Windows cases; these reports were not independently verified. I read all changed lines in core/relinker/main.cpp and core/relinker/relinker/tests/test_output_collisions.py. No changed files were excluded by the manifest; files.json was not available in the prepared bundle.

To get this to a good state

Nothing is required.

@ycbuzi

ycbuzi commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Tested af1e7a2a64 merged into main, with the whole ctest suite on each machine below. Nothing fails that does not also fail on main on the same machine.

  • Linux: Debian 13 in ChromeOS's Linux environment on a Pentium Silver N6000 (4 cores, SSE4.2, no AVX), GCC 14.2.0, relinker-only build (-DANYPS5_RELINKER_ONLY=ON): run 1: 99% tests passed, 5 tests failed out of 933; run 2: 99% tests passed, 5 tests failed out of 933; run 3: 99% tests passed, 5 tests failed out of 933. 5 of the failing tests fail on main too.

AI-assisted: yes (Claude Code); the runs are automated, this summary was written from their reports.

@github-actions

github-actions Bot commented Nov 16, 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 12678 core/relinker/main.cpp
PR 15245 core/relinker/main.cpp
PR 17557 core/relinker/main.cpp
core/relinker/relinker/tests/test_output_collisions.py

This was referenced Nov 21, 2026
@JustDownTV

Copy link
Copy Markdown
Contributor

Windows check of head af1e7a2a64, merged into main 042ae66ab1 (clean merge).

Setup: Windows 11 Pro 23H2 (22631), WinLibs GCC 15.2.0 UCRT r7, Python 3.12, Release relinker-only build. The hosted checks did not build this pull request.

  • output_collisions and secondary_output_collisions pass.
  • Full ctest -j 16: 1103 of 1106 pass. pr_overlap_tools, windows_fixed_base and windows_address_space fail the same way on main on this machine.
  • Output name differing from app0 only in case (APP0, App0), Linux and Windows output: the conversion exits with code 2, reports Output paths collide and leaves the tree unchanged. With --dry-run it exits with code 0, since the dry run does not probe case aliases; that is the existing --dry-run behaviour for case aliases, not something this change adds.

@oneandonlydean
oneandonlydean merged commit c804316 into boykopovar:main Nov 25, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants