Loader: match title DLL filenames ignoring ASCII case #1434

Open
github-bot wants to merge 1 commit from github-bot/gh-1434 into main AGit
Owner

@⁠fuzeofficlal on GitHub · 2026-11-24 17:58 UTC · original
fuzeofficlal:fix/loader-case-insensitive-title-dll-762 → main · +135 −4 · 2 files · 1 commits · open

Fixes #762.

Summary

  • Match title DLL files in dirs.0 case-insensitively (eq_ignore_ascii_case + path.is_file(), skipping colliding subdirectories) when the exact path is not a file so mixed-case title DLLs load properly on case-sensitive folders and broken images report their real on-disk filename in error context.

Verification

  • Added directory_scan_matches_files_ignoring_ascii_case_and_skips_folders and maps_mixed_case_title_dlls_in_case_sensitive_folders (using per-directory NTFS case sensitivity with colliding uppercase directory names and malformed DLL error checks).
  • cargo test -p victory-loader, cargo clippy --workspace --all-targets --all-features, and cargo xtask policy: passed.
**@⁠fuzeofficlal** on GitHub · 2026-11-24 17:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/1434) `fuzeofficlal:fix/loader-case-insensitive-title-dll-762` → `main` · +135 −4 · 2 files · 1 commits · open Fixes #762. ### Summary - Match title DLL files in `dirs.0` case-insensitively (`eq_ignore_ascii_case` + `path.is_file()`, skipping colliding subdirectories) when the exact path is not a file so mixed-case title DLLs load properly on case-sensitive folders and broken images report their real on-disk filename in error context. ### Verification - Added `directory_scan_matches_files_ignoring_ascii_case_and_skips_folders` and `maps_mixed_case_title_dlls_in_case_sensitive_folders` (using per-directory NTFS case sensitivity with colliding uppercase directory names and malformed DLL error checks). - `cargo test -p victory-loader`, `cargo clippy --workspace --all-targets --all-features`, and `cargo xtask policy`: passed.
map_dll previously lowercased the imported DLL name before joining it to
the title folder, skipping mixed-case title DLLs (such as Bink2Scarlett.dll
or libHttpClient.GDK.dll) without error whenever the title directory sits
on a case-sensitive filesystem (Linux ext4/btrfs/xfs under Wine/Proton,
WSL-created NTFS folders with inherited case sensitivity, or WSL2 9P
mounts).

Check the exact spelling first and fall back to an ASCII case-insensitive
directory scan that skips colliding directories, while keeping the
lowercase key for deduplication and the caller-visible module list.

Fixes #762.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:31:37 +00:00
Author
Owner

@⁠acetonahard-code on GitHub · 2026-11-24 21:15 UTC · original

Tested on Windows 11 with the repo toolchain, merged into current main (ffe310e):

cargo test -p victory-loader passed failed ignored
main 25 0 0
main + this PR 27 0 0
main, --all-features 26 0 -
main + this PR, --all-features 28 0 -
  • The 2 new tests pass.
  • cargo clippy --all-targets -- -D warnings, with and without --all-features: clean.

I didn't test with game data.


Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.

**@⁠acetonahard-code** on GitHub · 2026-11-24 21:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/1434#issuecomment-7144682139) Tested on Windows 11 with the repo toolchain, merged into current `main` (ffe310e): | `cargo test -p victory-loader` | passed | failed | ignored | |---|---|---|---| | `main` | 25 | 0 | 0 | | `main` + this PR | 27 | 0 | 0 | | `main`, `--all-features` | 26 | 0 | - | | `main` + this PR, `--all-features` | 28 | 0 | - | - The 2 new tests pass. - `cargo clippy --all-targets -- -D warnings`, with and without `--all-features`: clean. I didn't test with game data. --- <sub>Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.</sub>
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 03:27 UTC · original · edited 2026-11-25 07:21 UTC

Automated triage for the maintainers.

Merge candidate (update after your reply). map_dll in crates/victory-loader/src/windows.rs now tries the import name as written first. If that misses, it falls back to a case-insensitive directory scan (find_dll_file → scan_dll_file → select_dll_entry) and keeps the lowercased name as the seen/loaded key. Thanks for removing the fsutil call. The new tests are a pure unit test on select_dll_entry, a tempfile scan test, and a load test that copies version.dll the way existing load_probe.rs tests do. None of them spawn a process or change filesystem attributes, so the maintainer-decision point no longer applies.

Your reply points to a real defect in main. map_dll lowercases the name before dirs.0.join, so in a case-sensitive directory even an exact-case match is skipped silently. Folders created from WSL on NTFS are a real way to get such a directory. The Wine/Proton case is weaker, since Wine already does its own case-insensitive lookup.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 03:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/1434#issuecomment-7151933635) · edited 2026-11-25 07:21 UTC <!-- victory-triage v1 head=4339556a4f9f4d0f143176980c1247f4a7747539 verdict=merge-candidate at=2026-11-25T07:21:17Z --> Automated triage for the maintainers. **Merge candidate (update after your reply).** `map_dll` in `crates/victory-loader/src/windows.rs` now tries the import name as written first. If that misses, it falls back to a case-insensitive directory scan (`find_dll_file` → `scan_dll_file` → `select_dll_entry`) and keeps the lowercased name as the `seen`/`loaded` key. Thanks for removing the `fsutil` call. The new tests are a pure unit test on `select_dll_entry`, a `tempfile` scan test, and a load test that copies `version.dll` the way existing `load_probe.rs` tests do. None of them spawn a process or change filesystem attributes, so the maintainer-decision point no longer applies. Your reply points to a real defect in `main`. `map_dll` lowercases the name before `dirs.0.join`, so in a case-sensitive directory even an exact-case match is skipped silently. Folders created from WSL on NTFS are a real way to get such a directory. The Wine/Proton case is weaker, since Wine already does its own case-insensitive lookup. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 04:39 UTC · original

Rebased onto 940d32f (4339556a) and removed the fsutil process call and filesystem-attribute mutation, replacing it with an in-memory unit test on select_dll_entry.

On where this is reached in practice: map_dll previously lowercased name before joining the path (let name = name.to_ascii_lowercase(); let path = dirs.0.join(&name);), so in any case-sensitive directory even an exact-case match between the PE import descriptor and a mixed-case DLL filename on disk (FooBar.dll -> dirs.0.join("foobar.dll").is_file()) silently returned Ok(()) without loading the DLL, leaving its imports on missing stubs. That hits Linux + Wine/Proton runs backed by ext4/btrfs/xfs mounts without kernel casefold (as reported in #762) as well as directories created from WSL on NTFS (which inherit FILE_CS_FLAG_CASE_SENSITIVE_DIR) or accessed over \\wsl.localhost\....

**@⁠fuzeofficlal** on GitHub · 2026-11-25 04:39 UTC · [original](https://github.com/Marvisak/VIctory/pull/1434#issuecomment-7153045655) Rebased onto `940d32f` (`4339556a`) and removed the `fsutil` process call and filesystem-attribute mutation, replacing it with an in-memory unit test on `select_dll_entry`. On where this is reached in practice: `map_dll` previously lowercased `name` *before* joining the path (`let name = name.to_ascii_lowercase(); let path = dirs.0.join(&name);`), so in any case-sensitive directory even an exact-case match between the PE import descriptor and a mixed-case DLL filename on disk (`FooBar.dll` -> `dirs.0.join("foobar.dll").is_file()`) silently returned `Ok(())` without loading the DLL, leaving its imports on `missing` stubs. That hits Linux + Wine/Proton runs backed by `ext4`/`btrfs`/`xfs` mounts without kernel `casefold` (as reported in #762) as well as directories created from WSL on NTFS (which inherit `FILE_CS_FLAG_CASE_SENSITIVE_DIR`) or accessed over `\\wsl.localhost\...`.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1434/head:github-bot/gh-1434'
git switch 'github-bot/gh-1434'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1434'
git switch 'github-bot/gh-1434'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1434'
git switch 'github-bot/gh-1434'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1434'
git switch 'main'
git merge --squash 'github-bot/gh-1434'
git switch 'main'
git merge --ff-only 'github-bot/gh-1434'
git switch 'main'
git merge 'github-bot/gh-1434'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1434
No description provided.