test(relinker): run file writer replacement against a copy of the test binary #6877

Closed
root-over wants to merge 1 commit from upstream-pr/6877 into main
root-over commented 2026-10-16 15:35:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by root-over on 2026-10-16T15:35:22Z.


What

file_writer_binary and file_writer_text copied /bin/sleep under the name running (and leftover) and executed it. On recent Ubuntu /bin/sleep is uutils coreutils, a multicall binary that refuses to run under a name that is not a utility:

Security violation: Requested utility `running` does not match executable name:
  /tmp/anyps5-file-writer-97402/running (deleted)
Running executable stopped

so both tests failed there while FileWriter itself was fine. The test now copies its own executable (/proc/self/exe) and runs it with a sleep mode, so it no longer depends on how the distribution packages coreutils.

Tested

Ubuntu with uutils coreutils (/bin/sleep -> /usr/lib/cargo/bin/coreutils/sleep), GCC 15.2.0, CMake 4.2.3, Ninja, Release with BUILD_TESTING=ON:

  • Full build: file_writer_binary and file_writer_text fail on main and pass with this change; the rest of the suite is unchanged (the skipped tests are device capabilities of the GPU).
  • Relinker-only build (ANYPS5_RELINKER_ONLY=ON): 182/182 pass.
  • tools/check_conventions.py --base origin/main passes.

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
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4890648016 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6877). Originally posted by [root-over](https://github.com/root-over) on 2026-10-16T15:35:22Z. --- ### What `file_writer_binary` and `file_writer_text` copied `/bin/sleep` under the name `running` (and `leftover`) and executed it. On recent Ubuntu `/bin/sleep` is uutils coreutils, a multicall binary that refuses to run under a name that is not a utility: ``` Security violation: Requested utility `running` does not match executable name: /tmp/anyps5-file-writer-97402/running (deleted) Running executable stopped ``` so both tests failed there while `FileWriter` itself was fine. The test now copies its own executable (`/proc/self/exe`) and runs it with a `sleep` mode, so it no longer depends on how the distribution packages coreutils. ### Tested Ubuntu with uutils coreutils (`/bin/sleep -> /usr/lib/cargo/bin/coreutils/sleep`), GCC 15.2.0, CMake 4.2.3, Ninja, Release with `BUILD_TESTING=ON`: - Full build: `file_writer_binary` and `file_writer_text` fail on `main` and pass with this change; the rest of the suite is unchanged (the skipped tests are device capabilities of the GPU). - Relinker-only build (`ANYPS5_RELINKER_ONLY=ON`): 182/182 pass. - `tools/check_conventions.py --base origin/main` passes. ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-10-17 03:32:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-17T03:32:17Z.


Independent Linux validation on head b9b82f8e9: with GCC 12.2, Release, and ANYPS5_RELINKER_ONLY=ON, file_writer_tests builds and both file_writer_binary and file_writer_text pass (2/2). git diff --check upstream/main...HEAD and check_conventions.py --base upstream/main --head HEAD also pass. I did not find a concrete issue in the self-executable helper approach.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6229079174 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6877#issuecomment-6229079174). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-17T03:32:17Z. --- Independent Linux validation on head `b9b82f8e9`: with GCC 12.2, Release, and `ANYPS5_RELINKER_ONLY=ON`, `file_writer_tests` builds and both `file_writer_binary` and `file_writer_text` pass (2/2). `git diff --check upstream/main...HEAD` and `check_conventions.py --base upstream/main --head HEAD` also pass. I did not find a concrete issue in the self-executable helper approach.
blawesom commented 2026-10-17 09:38:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-17T09:38:20Z.


Rebase handoff — rebased onto current main (authorship unchanged). One conflict in FileWriterTests.cpp: main renamed the child's mode argument from sleep to wait after your branch point; the merged version follows main's naming.

Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON, AMD RX 9070 XT / RADV):

  • builds; tools/check_conventions.py --base origin/main passes
  • full suite: 1335/1336 — the only failure is the known main regression (agc_driver_tessellation segfault, #4727), not this PR

To pick it up:

git fetch https://github.com/blawesom/AnyPS5 rebase/6877
git checkout <your branch>
git merge --ff-only FETCH_HEAD

Head is adb0e7a8c.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6232379481 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6877#issuecomment-6232379481). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-17T09:38:20Z. --- **Rebase handoff** — rebased onto current `main` (authorship unchanged). One conflict in `FileWriterTests.cpp`: `main` renamed the child's mode argument from `sleep` to `wait` after your branch point; the merged version follows `main`'s naming. Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`, AMD RX 9070 XT / RADV): - builds; `tools/check_conventions.py --base origin/main` passes - **full suite: 1335/1336** — the only failure is the known `main` regression (`agc_driver_tessellation` segfault, #4727), not this PR **To pick it up:** ``` git fetch https://github.com/blawesom/AnyPS5 rebase/6877 git checkout <your branch> git merge --ff-only FETCH_HEAD ``` Head is `adb0e7a8c`.
root-over commented 2026-10-19 06:54:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by root-over on 2026-10-19T06:54:32Z.


Closing: the same fix landed on main in #6027 (3abfe906b), which was opened earlier. Thanks @MarcZX10 for the Linux validation and @blawesom for the rebase.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6261511621 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/6877#issuecomment-6261511621). Originally posted by [root-over](https://github.com/root-over) on 2026-10-19T06:54:32Z. --- Closing: the same fix landed on `main` in #6027 (3abfe906b), which was opened earlier. Thanks @MarcZX10 for the Linux validation and @blawesom for the rebase.

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!6877
No description provided.