fix(tools): reject ambiguous guest modules in import audit #5273

Merged
Ondra97 merged 1 commit from upstream-pr/5273 into main 2026-10-14 18:52:48 +00:00
Ondra97 commented 2026-10-13 16:13:51 +00:00 (Migrated from github.com)

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


What

Different guest modules with the same filename in repeated --modules directories silently replaced each other's imports and combined their exports. Depending on directory order, an audit could report success despite a missing import and needed library.

Reject differing module contents with both paths in the error, using the same SHA-256 identity policy as built libraries. Identical copies are audited once. Input conflicts are rejected before creating or replacing the JSON report.

Checked all 548 open PRs before publication and inspected the five that change the audit files: #5269, #4951, #4916, #4825 and #4425. None changes read_modules or implements this validation.

Tested

Windows, Python 3.14, synthetic ELF fixtures. CTest import_audit: 48/48 tests passed. The new regressions cover both directory orders, absent and existing JSON output, identical copies, repeated directories, imports, dependencies and export providers. Before the fix, all four conflicting-input cases failed with exit codes 0 or 1 instead of 2.

Local conventions check against origin/main and git diff --check passed. Python-only change; no title or runtime-library behavior is claimed.

CI Build passed the relinker build and CTest suite on Linux (155 tests), Windows (150 tests) and macOS (146 tests), with no failures. import_audit passed on all three platforms. Conventions and PR intake also passed. Full runtime-library jobs were skipped by the repository's automatic PR policy.

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:4846126812 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5273). Originally posted by [Ondra97](https://github.com/Ondra97) on 2026-10-13T16:13:51Z. --- ### What Different guest modules with the same filename in repeated `--modules` directories silently replaced each other's imports and combined their exports. Depending on directory order, an audit could report success despite a missing import and needed library. Reject differing module contents with both paths in the error, using the same SHA-256 identity policy as built libraries. Identical copies are audited once. Input conflicts are rejected before creating or replacing the JSON report. Checked all 548 open PRs before publication and inspected the five that change the audit files: #5269, #4951, #4916, #4825 and #4425. None changes `read_modules` or implements this validation. ### Tested Windows, Python 3.14, synthetic ELF fixtures. CTest `import_audit`: 48/48 tests passed. The new regressions cover both directory orders, absent and existing JSON output, identical copies, repeated directories, imports, dependencies and export providers. Before the fix, all four conflicting-input cases failed with exit codes 0 or 1 instead of 2. Local conventions check against `origin/main` and `git diff --check` passed. Python-only change; no title or runtime-library behavior is claimed. [CI Build](https://github.com/boykopovar/AnyPS5/actions/runs/38428782298) passed the relinker build and CTest suite on Linux (155 tests), Windows (150 tests) and macOS (146 tests), with no failures. `import_audit` passed on all three platforms. Conventions and PR intake also passed. Full runtime-library jobs were skipped by the repository's automatic PR policy. ### 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
adriadam10 commented 2026-10-14 18:10:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T18:10:58Z.


Checked read_modules (SHA-256 per file name, conflicting contents raise AuditError with both paths, identical copies audited once), and the new tests cover both directory orders, existing/absent JSON output and repeated directories. import_audit passes on the merged tree and fails when the fix is reverted; merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6175096434 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5273#issuecomment-6175096434). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T18:10:58Z. --- Checked `read_modules` (SHA-256 per file name, conflicting contents raise `AuditError` with both paths, identical copies audited once), and the new tests cover both directory orders, existing/absent JSON output and repeated directories. `import_audit` passes on the merged tree and fails when the fix is reverted; 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!5273
No description provided.