tools: import_audit.py reports a false FAIL for converted modules, because libX.prx is matched against the file name libX.prx.guest.prx #7174

Closed
opened 2026-10-17 14:54:05 +00:00 by oneandonlydean · 1 comment
oneandonlydean commented 2026-10-17 14:54:05 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-17T14:54:05Z.


tools/import_audit.py matches an import's library name against the module file names in --modules. Converted modules are named libX.prx.guest.prx, while the title's imports name libX.prx, so the library is never found among the modules and is reported as missing, even though the module is there and the loader resolves libX.prx to libX.prx.guest.prx.

On a Stray (PPSA02101) run this lists libSceNpCppWebApi.prx: 942 imports and $ORIGIN/libSceFace.prx.guest.prx as missing. That is a false FAIL: both modules are present. Main and #7159 give identical JSON for this input, so it is not introduced by that PR. It comes from classify/audit testing library in modules against the file name.

It is separate from #6378, which is about parsing a converted .guest.prx file on Windows (a PE, not an ELF). #7159 fixes that one, and once it lands, Windows users get past the crash and will hit this false FAIL on the same input. #4202 added the module-import checking this sits next to.

Suggested fix: when building modules, also record each *.guest.prx file under its base name (libX.prx), so an import of libX.prx finds it. Keep the full file name too, so existing matches don't change.

I haven't checked how many other titles are affected; any converted title with an import of a module that was converted would show it.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5899606882 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7174). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-17T14:54:05Z. --- `tools/import_audit.py` matches an import's library name against the module *file* names in `--modules`. Converted modules are named `libX.prx.guest.prx`, while the title's imports name `libX.prx`, so the library is never found among the modules and is reported as missing, even though the module is there and the loader resolves `libX.prx` to `libX.prx.guest.prx`. On a Stray (PPSA02101) run this lists `libSceNpCppWebApi.prx: 942 imports` and `$ORIGIN/libSceFace.prx.guest.prx` as missing. That is a false FAIL: both modules are present. Main and #7159 give identical JSON for this input, so it is not introduced by that PR. It comes from `classify`/`audit` testing `library in modules` against the file name. It is separate from #6378, which is about parsing a converted `.guest.prx` file on Windows (a PE, not an ELF). #7159 fixes that one, and once it lands, Windows users get past the crash and will hit this false FAIL on the same input. #4202 added the module-import checking this sits next to. Suggested fix: when building `modules`, also record each `*.guest.prx` file under its base name (`libX.prx`), so an import of `libX.prx` finds it. Keep the full file name too, so existing matches don't change. I haven't checked how many other titles are affected; any converted title with an import of a module that was converted would show it.
LeandroSSB commented 2026-10-17 15:02:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroSSB on 2026-10-17T15:02:27Z.


A branch that fixes this is ready for carry:

LeandroSSB/AnyPS5@fix/import-audit-guest-module-aliases (commit 1a08c9c0a, base 84b0d2f24 = current main).

The fix follows the suggested direction, at the call site: main() now builds the modules set with each *.guest.prx file also recorded under its base name (libX.prx.guest.prx → libX.prx), while module_imports keeps only the real files so the module's own imports are still audited exactly once and the conservation check is untouched. The full file name stays, so every existing match is unchanged; classify and both missing-library checks now find libX.prx, and audit_host_dependencies picks the aliases up through the same set.

Regression test test_converted_module_matches_imports_of_its_base_name reproduces the Stray shape: one game import naming libSceFace.prx, only libSceFace.prx.guest.prx present. Without the fix it reports the library missing and exits 2; with it the import classifies as module, missing_libraries is empty and the run exits 0.

Validated: python3 tools/tests/test_import_audit.py — 99 tests pass with the fix, and the new test fails on unpatched main (checked both directions). python3 tools/check_conventions.py --base origin/main passes, python3 tools/pr_overlap.py --branch fix/import-audit-guest-module-aliases reports no overlap with open pull requests.

A maintainer is welcome to carry the commit.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6235443836 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7174#issuecomment-6235443836). Originally posted by [LeandroSSB](https://github.com/LeandroSSB) on 2026-10-17T15:02:27Z. --- A branch that fixes this is ready for carry: **[`LeandroSSB/AnyPS5@fix/import-audit-guest-module-aliases`](https://github.com/LeandroSSB/AnyPS5/tree/fix/import-audit-guest-module-aliases)** (commit `1a08c9c0a`, base `84b0d2f24` = current `main`). The fix follows the suggested direction, at the call site: `main()` now builds the `modules` set with each `*.guest.prx` file also recorded under its base name (`libX.prx.guest.prx` → `libX.prx`), while `module_imports` keeps only the real files so the module's own imports are still audited exactly once and the conservation check is untouched. The full file name stays, so every existing match is unchanged; `classify` and both missing-library checks now find `libX.prx`, and `audit_host_dependencies` picks the aliases up through the same set. Regression test `test_converted_module_matches_imports_of_its_base_name` reproduces the Stray shape: one game import naming `libSceFace.prx`, only `libSceFace.prx.guest.prx` present. Without the fix it reports the library missing and exits 2; with it the import classifies as `module`, `missing_libraries` is empty and the run exits 0. **Validated**: `python3 tools/tests/test_import_audit.py` — 99 tests pass with the fix, and the new test fails on unpatched `main` (checked both directions). `python3 tools/check_conventions.py --base origin/main` passes, `python3 tools/pr_overlap.py --branch fix/import-audit-guest-module-aliases` reports no overlap with open pull requests. A maintainer is welcome to carry the commit. AI-assisted: yes (Claude Code)
Sign in to join this conversation.
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#7174
No description provided.