fix: output collision and progress fixes (4 commits) #6127

Closed
nabil88 wants to merge 6 commits from upstream-pr/6127 into main
nabil88 commented 2026-10-14 22:51:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by nabil88 on 2026-10-14T22:51:39Z.


Summary
Four independent fixes in the relinker CLI's pre-write collision checksand write-stage progress, prepared as an atomic commit series:

1-Remove unreachable Windows output-identity probe (spurious failures)
2-Disambiguate registry names for same-named guest modules
3-Make write-stage progress cover every output file
4-Canonicalize output paths once instead of per comparison pair

Testing

Full conversion run ×2 on NTFS with --write-registry
Same-named modules in different directories
stdout identical before/after for a plain run (no flags)
Build clean on Linux (GCC/Clang) — Windows build pending CI

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4865642093 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6127). Originally posted by [nabil88](https://github.com/nabil88) on 2026-10-14T22:51:39Z. --- Summary Four independent fixes in the relinker CLI's pre-write collision checksand write-stage progress, prepared as an atomic commit series: 1-Remove unreachable Windows output-identity probe (spurious failures) 2-Disambiguate registry names for same-named guest modules 3-Make write-stage progress cover every output file 4-Canonicalize output paths once instead of per comparison pair Testing Full conversion run ×2 on NTFS with --write-registry Same-named modules in different directories stdout identical before/after for a plain run (no flags) Build clean on Linux (GCC/Clang) — Windows build pending CI
github-actions[bot] commented 2026-10-14 23:16:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T23:16:25Z.


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 6115 core/relinker/main.cpp
PR 6156 core/relinker/main.cpp
PR 6314 core/relinker/main.cpp
PR 6328 core/relinker/main.cpp
PR 6351 core/relinker/main.cpp
PR 6715 core/relinker/main.cpp
PR 6802 core/relinker/main.cpp
PR 6927 core/relinker/main.cpp
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6180597992 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6127#issuecomment-6180597992). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T23:16:25Z. --- <!-- pr-overlap --> 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 6115](https://www.github.com/boykopovar/AnyPS5/pull/6115) | `core/relinker/main.cpp` | | [PR 6156](https://www.github.com/boykopovar/AnyPS5/pull/6156) | `core/relinker/main.cpp` | | [PR 6314](https://www.github.com/boykopovar/AnyPS5/pull/6314) | `core/relinker/main.cpp` | | [PR 6328](https://www.github.com/boykopovar/AnyPS5/pull/6328) | `core/relinker/main.cpp` | | [PR 6351](https://www.github.com/boykopovar/AnyPS5/pull/6351) | `core/relinker/main.cpp` | | [PR 6715](https://www.github.com/boykopovar/AnyPS5/pull/6715) | `core/relinker/main.cpp` | | [PR 6802](https://www.github.com/boykopovar/AnyPS5/pull/6802) | `core/relinker/main.cpp` | | [PR 6927](https://www.github.com/boykopovar/AnyPS5/pull/6927) | `core/relinker/main.cpp` |
jotitadev commented 2026-10-14 23:34:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-14T23:34:13Z.

Review: COMMENTED


Static read of head 8166150bd (not built). Two things in core/relinker/main.cpp look wrong independent of platform:

  1. .needed.json files are no longer written. The old --write-registry block wrote both registryPaths[i] and neededPaths[i] for every executable and guest module. The new block only calls writeAndReport for the registry files, and neededPaths is still computed and collision-checked but never written. outputCount also only counts registryPaths.size(), so the progress total matches the reduced set.
  2. Stray brace / duplicated check. After registryPaths.insert(...) the hunk adds for (...) checkOutputInputs(path, "Registry"); and then a }. That } closes if (args.writeRegistry) before the original checkOutputInputs loop, the neededPaths derivation and the closing brace that follow it. A rough brace count on the file gives one more } than on main. With the current CI only conventions ran (it fails), so the build hasn't checked this yet.

Also, the // ... comments added in SameOutputFile and before the output collision loop conflict with the comments rule in docs/dev/CONVENTIONS.md, and return false; after the new return is unreachable.

Written with AI assistance (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5526091871 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6127#pullrequestreview-5526091871). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-14T23:34:13Z. **Review:** COMMENTED --- Static read of head `8166150bd` (not built). Two things in `core/relinker/main.cpp` look wrong independent of platform: 1. **`.needed.json` files are no longer written.** The old `--write-registry` block wrote both `registryPaths[i]` and `neededPaths[i]` for every executable and guest module. The new block only calls `writeAndReport` for the registry files, and `neededPaths` is still computed and collision-checked but never written. `outputCount` also only counts `registryPaths.size()`, so the progress total matches the reduced set. 2. **Stray brace / duplicated check.** After `registryPaths.insert(...)` the hunk adds `for (...) checkOutputInputs(path, "Registry");` and then a `}`. That `}` closes `if (args.writeRegistry)` before the original `checkOutputInputs` loop, the `neededPaths` derivation and the closing brace that follow it. A rough brace count on the file gives one more `}` than on `main`. With the current CI only `conventions` ran (it fails), so the build hasn't checked this yet. Also, the `// ...` comments added in `SameOutputFile` and before the output collision loop conflict with the comments rule in `docs/dev/CONVENTIONS.md`, and `return false;` after the new `return` is unreachable. Written with AI assistance (Claude Code).
jotitadev commented 2026-10-15 04:28:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-15T04:28:32Z.

Review: COMMENTED


Revalidated on the new head. It does not compile with Apple clang.

Machine: Apple M2 Max, macOS 27.2, Xcode 27 (Apple clang), cmake 4.4.4, /usr/bin/python3 3.9.6.
Head: 7d5848a97 (previously looked at 8166150bd). Base: main d92a8dad3 (PR diff taken from its merge-base eea428ca8, applies cleanly). Relinker-only build, -DANYPS5_RELINKER_ONLY=ON.

Build error (arm64 and x86_64/Rosetta):

core/relinker/main.cpp:338:68: error: unexpected character <U+200F>

Line 338 in 7d5848a97 is if (args.writeRegistry) outputCount += registryPaths.size()<U+200F>;. There is an invisible RIGHT-TO-LEFT MARK between ) and ;. It was introduced by the last commit and was not in 8166150bd. Deleting that one character is enough for the file to build.

Tests with the character stripped (arm64, Python 3.9): 155/163. Base on the same setup is 158/163 (the 5 known Python 3.9 / Linux-only failures). The three extra failures are caused by the PR no longer writing *.needed.json:

  • guest_registry (FileNotFoundError: .../output.needed.json)
  • needed_libraries (tools/import_audit.py read_needed_registry)
  • call_registry

If dropping .needed.json is intended, those tests and import_audit.py need to be updated in the same PR.

Not covered: the new head adds no test for the collision behaviour, so there was nothing to check for "fails without the fix".

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5528034952 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6127#pullrequestreview-5528034952). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-15T04:28:32Z. **Review:** COMMENTED --- Revalidated on the new head. It does not compile with Apple clang. **Machine:** Apple M2 Max, macOS 27.2, Xcode 27 (Apple clang), cmake 4.4.4, `/usr/bin/python3` 3.9.6. **Head:** 7d5848a97 (previously looked at 8166150bd). **Base:** main d92a8dad3 (PR diff taken from its merge-base eea428ca8, applies cleanly). Relinker-only build, `-DANYPS5_RELINKER_ONLY=ON`. **Build error (arm64 and x86_64/Rosetta):** ``` core/relinker/main.cpp:338:68: error: unexpected character <U+200F> ``` Line 338 in 7d5848a97 is `if (args.writeRegistry) outputCount += registryPaths.size()<U+200F>;`. There is an invisible RIGHT-TO-LEFT MARK between `)` and `;`. It was introduced by the last commit and was not in 8166150bd. Deleting that one character is enough for the file to build. **Tests with the character stripped** (arm64, Python 3.9): 155/163. Base on the same setup is 158/163 (the 5 known Python 3.9 / Linux-only failures). The three extra failures are caused by the PR no longer writing `*.needed.json`: - `guest_registry` (`FileNotFoundError: .../output.needed.json`) - `needed_libraries` (`tools/import_audit.py` `read_needed_registry`) - `call_registry` If dropping `.needed.json` is intended, those tests and `import_audit.py` need to be updated in the same PR. Not covered: the new head adds no test for the collision behaviour, so there was nothing to check for "fails without the fix". Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
simonbronk commented 2026-10-15 19:22:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by simonbronk on 2026-10-15T19:22:40Z.


I prepared an applicable repair candidate for head 7d5848a97f, following jotitadev's review and the workaround-removal risk documented in #6328. AI-assisted; native Windows verification below.

The bundle contains two sequential patches and one combined patch, confined to main.cpp:

  1. Remove the U+200F build blocker, restore WriteNeededLibraries for each executable/module through writeAndReport, and count neededPaths in the write total.
  2. Restore the original SameOutputFile Windows permission-mismatch workaround from eea428ca8. Keep this PR's cached canonical paths and registry naming changes.

The output-identity workaround is exercised on this machine. A real NTFS hard link between output.exe and a converted module output has the same native file ID, but without the workaround conversion returns 0 and overwrites the previous output bytes. Restoring the helper returns 2 with Output paths collide and preserves all five existing output files and both inputs. This is output/output protection; #6328's additional input/output checks remain separate.

The missing companions also change audit behavior: four synthetic cases (Linux/Windows conversion output, dependency in the main image or bundled module) return conversion success and 100% write progress. Without companions, the real import_audit CLI incorrectly exits 0 while Party.prx is absent. The repair writes ["Party.prx"], and the same audit correctly exits 1 reporting that missing dependency with zero imports. Input hashes remain unchanged.

Windows 11, WinLibs GCC 15.2 r7 UCRT, CMake/Ninja Release, Python 3.12.14, relinker-only:

  • Untouched head: GCC rejects U+200F at main.cpp:338. The behavioral control removes only that character; it is not an unmodified-head runtime claim.
  • Syntax-only control: all three dependency CTests fail; the two Windows output-collision suites also reproduce the overwrite failure.
  • Combined repair: native build succeeds; guest_registry, needed_libraries, call_registry, output_collisions, secondary_output_collisions and input_preservation all pass (six CTests, 17.17 s). Existing test sources/assertions are unchanged.
  • Full final core/relinker run: 125 passed, 2 failed out of 127, 170.22 s. windows_fixed_base times out in the parallel suite but passes in standalone runs with the control and repaired binaries; windows_icon gets WinError 5 starting its generated executable with both versions. These remain unresolved, so this is not an all-green validation. Host-dependent internal skips and a diagnostics test over 30 s are disclosed in the bundle.
  • Trusted main checker 44df21632 passes the candidate's incremental diff against this PR head; git diff --check passes. The combined patch applies to the original and reproduces the compiled source bytes with autocrlf=false.

Bundle: patches, original/intermediate/repaired source, raw results, build/CTest logs and reproducible native probes. No new PR or push, current-main merge/rebase, composition with #6115/#6328, full system-library build, Linux/macOS host run, real title, GPU or FPS claim. Please review/apply as appropriate; the remaining full-suite failures still need resolution.

relinker-important-repairs-pr6127.zip

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6200421504 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6127#issuecomment-6200421504). Originally posted by [simonbronk](https://github.com/simonbronk) on 2026-10-15T19:22:40Z. --- I prepared an applicable repair candidate for head 7d5848a97f9f7cde537b8fdcc61f1dd538decc23, following jotitadev's review and the workaround-removal risk documented in #6328. AI-assisted; native Windows verification below. The bundle contains two sequential patches and one combined patch, confined to main.cpp: 1. Remove the U+200F build blocker, restore WriteNeededLibraries for each executable/module through writeAndReport, and count neededPaths in the write total. 2. Restore the original SameOutputFile Windows permission-mismatch workaround from eea428ca8. Keep this PR's cached canonical paths and registry naming changes. The output-identity workaround is exercised on this machine. A real NTFS hard link between output.exe and a converted module output has the same native file ID, but without the workaround conversion returns 0 and overwrites the previous output bytes. Restoring the helper returns 2 with Output paths collide and preserves all five existing output files and both inputs. This is output/output protection; #6328's additional input/output checks remain separate. The missing companions also change audit behavior: four synthetic cases (Linux/Windows conversion output, dependency in the main image or bundled module) return conversion success and 100% write progress. Without companions, the real import_audit CLI incorrectly exits 0 while Party.prx is absent. The repair writes ["Party.prx"], and the same audit correctly exits 1 reporting that missing dependency with zero imports. Input hashes remain unchanged. Windows 11, WinLibs GCC 15.2 r7 UCRT, CMake/Ninja Release, Python 3.12.14, relinker-only: - Untouched head: GCC rejects U+200F at main.cpp:338. The behavioral control removes **only that character**; it is not an unmodified-head runtime claim. - Syntax-only control: all three dependency CTests fail; the two Windows output-collision suites also reproduce the overwrite failure. - Combined repair: native build succeeds; guest_registry, needed_libraries, call_registry, output_collisions, secondary_output_collisions and input_preservation all pass (six CTests, 17.17 s). Existing test sources/assertions are unchanged. - Full final core/relinker run: **125 passed, 2 failed out of 127**, 170.22 s. windows_fixed_base times out in the parallel suite but passes in standalone runs with the control and repaired binaries; windows_icon gets WinError 5 starting its generated executable with both versions. These remain unresolved, so this is not an all-green validation. Host-dependent internal skips and a diagnostics test over 30 s are disclosed in the bundle. - Trusted main checker 44df21632 passes the candidate's incremental diff against this PR head; git diff --check passes. The combined patch applies to the original and reproduces the compiled source bytes with autocrlf=false. Bundle: patches, original/intermediate/repaired source, raw results, build/CTest logs and reproducible native probes. No new PR or push, current-main merge/rebase, composition with #6115/#6328, full system-library build, Linux/macOS host run, real title, GPU or FPS claim. Please review/apply as appropriate; the remaining full-suite failures still need resolution. [relinker-important-repairs-pr6127.zip](https://github.com/user-attachments/files/33511101/relinker-important-repairs-pr6127.zip)
adriadam10 commented 2026-10-16 23:33:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T23:33:25Z.


Closing this one, for these reasons:

  • core/relinker/main.cpp:338 contains a stray U+200F (right-to-left mark) after registryPaths.size(); it does not compile (confirmed by @jotitadev with Apple clang), which contradicts "Build clean on Linux" in the description.
  • .needed.json files are no longer written with --write-registry: neededPaths is still computed and collision-checked, but nothing writes it, and the progress total hides the omission.
  • The SameOutputFile Windows read-only/permission-mismatch handling is removed as "unreachable", but #6328 documents that it works around a real case; no evidence is given that it is dead.
  • Four unrelated changes in one PR (CONTRIBUTING: one topic per PR), a merge commit in the history, conflicts with main, the Conventions check is red, and there are no tests for any of the four fixes.
  • The review feedback from @jotitadev and the repair patch from @simonbronk have had no answer.

You're welcome to reopen, or open separate small PRs, rebased on main, one fix each, with a test that fails without it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6226661486 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6127#issuecomment-6226661486). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-16T23:33:25Z. --- Closing this one, for these reasons: - `core/relinker/main.cpp:338` contains a stray U+200F (right-to-left mark) after `registryPaths.size()`; it does not compile (confirmed by @jotitadev with Apple clang), which contradicts "Build clean on Linux" in the description. - `.needed.json` files are no longer written with `--write-registry`: `neededPaths` is still computed and collision-checked, but nothing writes it, and the progress total hides the omission. - The `SameOutputFile` Windows read-only/permission-mismatch handling is removed as "unreachable", but #6328 documents that it works around a real case; no evidence is given that it is dead. - Four unrelated changes in one PR (CONTRIBUTING: one topic per PR), a merge commit in the history, conflicts with `main`, the Conventions check is red, and there are no tests for any of the four fixes. - The review feedback from @jotitadev and the repair patch from @simonbronk have had no answer. You're welcome to reopen, or open separate small PRs, rebased on `main`, one fix each, with a test that fails without it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!6127
No description provided.