fix(relinker): preserve inputs when writing desktop assets #3678

Merged
Ondra97 merged 1 commit from upstream-pr/3678 into main 2026-10-11 21:49:59 +00:00
Ondra97 commented 2026-10-11 15:13:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-11T15:13:10Z.


What

When producing a Linux executable with an icon, the relinker could overwrite the input ELF or a converted module through the generated <output>.png or <output>.desktop path, including hard links and symbolic links, while returning success.

Check those paths against the input executable and module sources before writing any output. Reuse the existing registry-output validation and retain replacement of unrelated existing outputs. Extend the existing input-preservation test and document the output collision rule.

Tested

Windows, WinLibs MinGW-w64 GCC 15.2.0 UCRT/POSIX/SEH r7, Release, relinker-only build, based on main a11c8f7f70a0ed4e71504a89de69e8cdae687817.

  • The original relinker reproduced input replacement on synthetic ELF files and returned 0. The extended input_preservation test failed before the fix and passed after it.
  • Added 24 collision cases covering both auxiliary outputs, executable and module inputs, direct paths, hard links and symbolic links, with and without --registry. Each checks that input bytes and existing outputs remain unchanged and no converted module output is written.
  • Non-colliding creation and replacement of icon and desktop outputs pass.
  • Full relinker-only CTest suite: 108/108 passed.
  • Repository conventions checker applied to the working-tree diff, test-registration check and git diff --check: passed.

Linux ELF output generation was tested on Windows. Native Linux/macOS builds and game execution were not tested.

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; no silent stubs added
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source; no dependencies added
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes; prepared with OpenAI Codex
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4820058930 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3678). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-11T15:13:10Z. --- ### What When producing a Linux executable with an icon, the relinker could overwrite the input ELF or a converted module through the generated `<output>.png` or `<output>.desktop` path, including hard links and symbolic links, while returning success. Check those paths against the input executable and module sources before writing any output. Reuse the existing registry-output validation and retain replacement of unrelated existing outputs. Extend the existing input-preservation test and document the output collision rule. ### Tested Windows, WinLibs MinGW-w64 GCC 15.2.0 UCRT/POSIX/SEH r7, Release, relinker-only build, based on main `a11c8f7f70a0ed4e71504a89de69e8cdae687817`. - The original relinker reproduced input replacement on synthetic ELF files and returned 0. The extended `input_preservation` test failed before the fix and passed after it. - Added 24 collision cases covering both auxiliary outputs, executable and module inputs, direct paths, hard links and symbolic links, with and without `--registry`. Each checks that input bytes and existing outputs remain unchanged and no converted module output is written. - Non-colliding creation and replacement of icon and desktop outputs pass. - Full relinker-only CTest suite: 108/108 passed. - Repository conventions checker applied to the working-tree diff, test-registration check and `git diff --check`: passed. Linux ELF output generation was tested on Windows. Native Linux/macOS builds and game execution were not tested. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; no silent stubs added - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source; no dependencies added - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes; prepared with OpenAI Codex
adriadam10 commented 2026-10-11 21:49:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:49:54Z.


Checked on Linux: relinker build + ctest 101/101 green; the extended input_preservation test fails without the main.cpp change and passes with it. The icon/desktop-entry checks run before any output is written, and reuse the registry validation. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114182506 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3678#issuecomment-6114182506). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T21:49:54Z. --- Checked on Linux: relinker build + ctest 101/101 green; the extended `input_preservation` test fails without the `main.cpp` change and passes with it. The icon/desktop-entry checks run before any output is written, and reuse the registry validation. Merging.
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!3678
No description provided.