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

Merged
Damokles2 merged 1 commit from upstream-pr/1863 into main 2026-11-25 21:52:04 +00:00
Damokles2 commented 2026-11-24 23:45:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Damokles2 on 2026-11-24T23:45:55Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6593752643 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1863). Originally posted by [Damokles2](https://github.com/Damokles2) on 2026-11-24T23:45:55Z. --- **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 commented 2026-11-25 00:06:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T23:47:48Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:Marvisak/VIctory:review:6049283864 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1863#pullrequestreview-6049283864). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T23:47:48Z. **Review:** COMMENTED --- 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 commented 2026-11-25 01:08:19 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oddmaniv on 2026-11-25T00:56:36Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149047679 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1863#issuecomment-7149047679). Originally posted by [oddmaniv](https://github.com/oddmaniv) on 2026-11-25T00:56:36Z. --- 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.
Marvisak commented 2026-11-25 08:06:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T07:26:13Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7155857916 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1863#issuecomment-7155857916). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T07:26:13Z. --- <!-- victory-triage v1 head=c0af92af23b6d7504a515fc5b2e1d13fdacffecd verdict=merge-candidate at=2026-11-25T11:21:30Z --> 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](https://claude.ai/code)_
Damokles2 commented 2026-11-25 10:07:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Damokles2 on 2026-11-25T09:20:24Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7158197943 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1863#issuecomment-7158197943). Originally posted by [Damokles2](https://github.com/Damokles2) on 2026-11-25T09:20:24Z. --- 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 commented 2026-11-25 12:03:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-25T11:09:11Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7160662966 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1863#issuecomment-7160662966). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-25T11:09:11Z. --- 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.
upstream-sync closed this pull request 2026-11-25 22:03:13 +00:00
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
Marvisak/VIctory!1861
No description provided.