fix(tools): ignore non-module sidecars in import audit #5519

Merged
Zinebyte merged 1 commit from upstream-pr/5519 into main 2026-10-14 21:39:08 +00:00
Zinebyte commented 2026-10-13 22:11:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Zinebyte on 2026-10-13T22:11:23Z.


What

The documented import-audit workflow fails when a title's module directory contains a README or other metadata. The relinker accepts that directory, but import_audit.py --modules attempts to parse every file as ELF and exits 2 before reporting the imports.

Select ELF module candidates by their header, regardless of filename. Ignore ordinary non-module sidecars; retain errors for malformed named module files, unsupported ELF, PE and SELF containers. Metadata cannot become a module provider or satisfy a missing dependency. The usage documentation states this selection policy.

Reproduced with the repository's existing main_fixture() and module_with_symbol(True) fixtures: conversion with --registry succeeds with sce_module/provider.prx and a 22-byte README.txt; auditing those generated registries fails on README's ELF header. Removing only README makes the baseline audit succeed. With this patch the same audit succeeds with README present. No title files were used.

Tested

Zorin OS 18.1 x86-64, Python 3.12.3, GCC 13.3.0, CMake 3.28.3; final branch based on bf8dc610e665a7547d027418e31ddcbb3261b3e0. Original regression baseline: c7601b797119da8e81191dd7d31bdfffd77d9f3b; the two audit files are unchanged between those upstream revisions.

  • The same four new tests were run against the exact baseline: the sidecar regression fails; three preservation controls pass. Patched import-audit suite: 50/50 pass.
  • CLI-entry regressions verify unchanged text/JSON reports with README, text, JSON, .DS_Store and empty metadata; real imports, exports and dependencies in an ELF with a nonstandard extension; missing imports named after metadata; malformed/PE/SELF refusal without creating or replacing the JSON report.
  • Full Release relinker-only build and all 155 configured CTests pass in 14.63 s on the final branch. Conventions and whitespace checks pass. Existing assertions are retained.
  • Independent composition with #5273 head 27e5a6d75d96eab58175451938b43b14f42cc34a applies cleanly with Git's three-way merge; all 52 combined audit tests pass. An additional control with different README contents beside identical modules audits the module once and still reports its real missing import.

Hosted relinker CI passed on Linux, Windows and macOS at final head 3b2601daa348a7953bd90a1ed9ca71d99fad9070; eligibility and conventions also passed. The original submission passed intake. The implementation and tests are unchanged by the documentation clarification and rebase.

#5273 adds duplicate-module identity checks inside read_modules; it does not select module candidates. This patch changes the iterator through a separate helper, so duplicate checks run only for actual modules in the tested composition. Neither patch requires the other. The repository's overlap checker reports no conflict at current main with both dependency lists empty.

Checklist

  • Based on current main; no equivalent module-selection fix found
  • One topic per PR; follow-ups go in a new PR
  • No added code comments
  • No runtime stubs or silent fallback for malformed modules
  • No notes, investigation files, images or dependencies added
  • Generic behaviour
  • Depends on: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes, OpenAI Codex; implementation, tests, independent review and description
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4850135946 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5519). Originally posted by [Zinebyte](https://github.com/Zinebyte) on 2026-10-13T22:11:23Z. --- ### What The documented import-audit workflow fails when a title's module directory contains a README or other metadata. The relinker accepts that directory, but `import_audit.py --modules` attempts to parse every file as ELF and exits 2 before reporting the imports. Select ELF module candidates by their header, regardless of filename. Ignore ordinary non-module sidecars; retain errors for malformed named module files, unsupported ELF, PE and SELF containers. Metadata cannot become a module provider or satisfy a missing dependency. The usage documentation states this selection policy. Reproduced with the repository's existing `main_fixture()` and `module_with_symbol(True)` fixtures: conversion with `--registry` succeeds with `sce_module/provider.prx` and a 22-byte `README.txt`; auditing those generated registries fails on README's ELF header. Removing only README makes the baseline audit succeed. With this patch the same audit succeeds with README present. No title files were used. ### Tested Zorin OS 18.1 x86-64, Python 3.12.3, GCC 13.3.0, CMake 3.28.3; final branch based on `bf8dc610e665a7547d027418e31ddcbb3261b3e0`. Original regression baseline: `c7601b797119da8e81191dd7d31bdfffd77d9f3b`; the two audit files are unchanged between those upstream revisions. - The same four new tests were run against the exact baseline: the sidecar regression fails; three preservation controls pass. Patched import-audit suite: 50/50 pass. - CLI-entry regressions verify unchanged text/JSON reports with README, text, JSON, `.DS_Store` and empty metadata; real imports, exports and dependencies in an ELF with a nonstandard extension; missing imports named after metadata; malformed/PE/SELF refusal without creating or replacing the JSON report. - Full Release relinker-only build and all 155 configured CTests pass in 14.63 s on the final branch. Conventions and whitespace checks pass. Existing assertions are retained. - Independent composition with #5273 head `27e5a6d75d96eab58175451938b43b14f42cc34a` applies cleanly with Git's three-way merge; all 52 combined audit tests pass. An additional control with different README contents beside identical modules audits the module once and still reports its real missing import. [Hosted relinker CI](https://github.com/boykopovar/AnyPS5/actions/runs/38477775157) passed on Linux, Windows and macOS at final head `3b2601daa348a7953bd90a1ed9ca71d99fad9070`; eligibility and conventions also passed. The original submission passed intake. The implementation and tests are unchanged by the documentation clarification and rebase. ### Related work #5273 adds duplicate-module identity checks inside `read_modules`; it does not select module candidates. This patch changes the iterator through a separate helper, so duplicate checks run only for actual modules in the tested composition. Neither patch requires the other. The repository's overlap checker reports no conflict at current `main` with both dependency lists empty. ### Checklist - [x] Based on current `main`; no equivalent module-selection fix found - [x] One topic per PR; follow-ups go in a new PR - [x] No added code comments - [x] No runtime stubs or silent fallback for malformed modules - [x] No notes, investigation files, images or dependencies added - [x] Generic behaviour - [x] Depends on: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes, OpenAI Codex; implementation, tests, independent review and description
adriadam10 commented 2026-10-14 21:38:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T21:38:55Z.


Checked module_files() selection by ELF header, the sidecar/malformed/PE/SELF cases and the USAGE.md change. test_import_audit passes (79 OK) and the new tests fail without the fix; relinker CI is green on Linux, Windows and macOS. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6179073585 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5519#issuecomment-6179073585). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T21:38:55Z. --- Checked `module_files()` selection by ELF header, the sidecar/malformed/PE/SELF cases and the USAGE.md change. `test_import_audit` passes (79 OK) and the new tests fail without the fix; relinker CI is green on Linux, Windows and macOS. 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!5519
No description provided.