Skip to content

fix(census): report unreadable files during PE detection - #1863

Open
Damokles2 wants to merge 1 commit into
Marvisak:mainfrom
Damokles2:fix-census-unreadable-files
Open

Damokles2 wants to merge 1 commit into
Marvisak:mainfrom
Damokles2:fix-census-unreadable-files

Conversation

@Damokles2

Copy link
Copy Markdown

Summary

  • Propagate I/O errors from looks_like_pe() instead of silently treating unreadable files as non-PE files.
  • Report affected paths through the existing unreadable mechanism.
  • Continue scanning remaining files after an I/O error.
  • Preserve existing behavior for empty, short and non-PE files.

Testing

  • Passed: Isolated Windows-MSVC reproduction of ERROR_SHARING_VIOLATION (Win32 error 32).
  • Passed: git diff --check and targeted formatting checks.
  • Not verified: Full CLI regression test and Clippy. Both were blocked because the local Windows application-control policy rejected a Rust build script (OS error 4551).

The regression test uses synthetic files and requires no game assets.

Additional notes

This addresses file-read failures after directory traversal, separately from the traversal errors covered by #115.

AI-assisted using OpenAI Codex.

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Static review only: apps-side census tool; reviewed from the diff.

census: report unreadable files during PE detection instead of skipping silently: error reporting fix in the census tool. apps-side.

@oddmaniv

Copy link
Copy Markdown

Independently tested @Damokles2’s fix on native Windows with Rust 1.98.1 in two configurations:

Exact current PR head — 0e4c06c

  • Clean, unmodified checkout; no adaptation or additional tests.
  • The PR’s unreadable-file regression passed: the locked synthetic PE is reported while the readable file is still scanned.
  • All tests from cargo test --locked -p victory passed.

Earlier patch adapted onto main — e9b2873 adapted to 02deab1

  • The original direct-file test and an additional directory-traversal regression both failed on unmodified main (1 images scanned, 0 unreadable).
  • Both passed with the adaptation (1 images scanned, 1 unreadable), including a repeat run. The directory test also verifies continued scanning of a readable sibling.
  • Two census unit tests and two existing census CLI integration tests passed.

Both configurations passed workspace Clippy—all targets, default and all features, warnings denied—and asset policy. The adaptation also passed changed-file formatting checks.

The full workspace test suite was not run. Synthetic fixtures only; no game data or game/GPU execution. AI-assisted.

github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. No change since the last triage (head still c0af92a). looks_like_pe in apps/victory/src/census.rs returns io::Result<bool>, and run adds open/read errors other than UnexpectedEof to the existing failed list, which prints as "unreadable"/"skipped", then keeps scanning. Empty, short and non-PE files are still skipped silently, as on main. The Windows-only test apps/victory/tests/census_unreadable.rs locks a synthetic PE with share mode 0 and expects 1 images scanned, 1 unreadable. CI: passing (check).

On your reply: thanks, nothing more is needed. @cloph-dsp reports that the new test passes on native Windows at this head, which covers the run your local policy blocked.


Generated by Claude Code

@Damokles2

Copy link
Copy Markdown
Author

Thanks for the review! I've updated the existing PR branch with a clean commit (c0af92a) directly on upstream main.

The PR now contains only the census fix and its Windows regression test, using the current Vec<String> error format.

Formatting and strict Windows-MSVC Clippy passed. The tests compiled, but local Windows Application Control blocked their execution (OS error 4551).

AI-assisted using OpenAI Codex.

@cloph-dsp

Copy link
Copy Markdown

Independent local validation (Windows, Rust 1.100.0/MSVC, head c0af92a, no game data): cargo test --locked -p victory --test census_unreadable -> 1 test passed (census_reports_unreadable_files_and_continues_scanning), exit 0; cargo test --locked -p victory -> 53 tests passed, exit 0. Caveat: my capture of the main 940d32f baseline was truncated, so I cannot compare total test counts directly; the new test itself passes here. Author reported this head not runnable under App Control/OS 4551, but it ran here. Windows exclusive-share handle semantics may still differ from Wine/Linux. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU-only tests). No game data used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants