HLE: skip junctions in the persistent-storage quota count #2990
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2990
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2990"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@Halfect on GitHub · 2026-11-26 02:28 UTC · original
Halfect:fix/pls-used-bytes-reparse→main· +126 −11 · 2 files · 2 commits · openFixes VIC-BT-040 from #1249.
What
used_byteswalks the title's persistent-local-storage folder to enforce the manifest quota. It decided what to do with each entry viaDirEntry::metadata(), and it recursed:metadata()reports the target of a reparse point, so a directory junction is seen as a real directory and walked.The walk now uses an explicit stack and
file_type()from the directory listing: links (junctions included) are skipped, real directories are descended into, and everything else contributes its length.Testing
used_bytes_skips_junctions(Windows): a junction cycle into the folder itself and one pointing outside the tree; only the real files are counted and the walk terminates.cargo test --locked -p victory-hle: 153 passed.cargo clippy --locked -p victory-hle --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Limitations
Windows-only behavior change verified on Windows; the link check is
cfg-free and behaves the same on other hosts (symlinks skipped there too). Not run against a real title's storage folder.No game data. AI-assisted (Kimi).
@futurepro62 on GitHub · 2026-11-26 04:58 UTC · original
Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head
5a94a83(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 867 passed, 0 failed, 10 ignored.used_bytes_skips_junctions.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
@Halfect on GitHub · 2026-11-26 05:03 UTC · original
Thanks @futurepro62 for the full-suite run on the RTX 5070 Ti — 867 passed / 0 failed on the exact head
5a94a83, with the newused_bytes_skips_junctionstest passing and the skips accounted for by pre-existing main-side issues (#2571, #1835/#2317, #1744), is exactly the coverage this change needed. Nothing further from my side; ready for review.@Marvisak on GitHub · 2026-11-26 05:23 UTC · original
Automated triage for the maintainers.
Needs work: needs the maintainer's decision. The change itself reads correctly:
used_bytesincrates/victory-hle/src/modules/storage.rsnow walks the title's storage folder with an explicit stack instead of recursion, and skips entries whosefile_type()is a link. On Windows Rust reports junctions (mount-point reparse points) as symlinks there, so a junction into its own parent no longer recurses until the stack overflows, and one pointing outside isn't charged to the quota. The user-visible case is narrow (someone has to put a junction in the storage folder), but the fix is small and safe.The reason for the maintainer's decision: the new test
used_bytes_skips_junctionsspawnscmd /c mklink /Jto make its junctions. Other tests do start processes (the test binary itself,dxc), but none shell out tocmd. If that's not acceptable, the junction could be made through the reparse-point API withwindows-sys, which the crate already uses, or the test dropped.CI: passing; a full-suite run in this thread on an RTX 5070 Ti also passed, including the new test.
Generated by Claude Code
@kotekompotek on GitHub · 2026-11-26 02:35 UTC · original · reviewed
Verified: DirEntry::file_type() doesn't follow links, and junctions report is_symlink()==true (mount-point reparse points are name surrogates), so both the self-cycle and the escape junction are skipped — the test asserts exactly 15 bytes. The iterative walk also removes the old recursion's stack-overflow path. Right call to count only the title's real files toward its quota.
@fuzeofficlal on GitHub · 2026-11-26 02:58 UTC · original · approved these changes
Code review on
5a94a83b(static source inspection; no Windows runtime execution):crates/victory-hle/src/modules/storage.rs:94-115cleanly replaces recursion with an explicit worklist and skips symlinks/reparse points (is_symlink()) before descending, avoiding stack-depth hazards and junction loops/escapes on stable directory trees.:259covers both a self-referential junction inside the tree and an external junction target.:102-109before opening the queued path at:98remains subject to a TOCTOU swap if another process replaces a directory with a junction mid-walk, which is acceptable for ordinary title persistent-storage quota accounting.@Halfect on GitHub · 2026-11-26 11:41 UTC · original
The
cmd /c mklink /Jdependency is gone in22a2af9— the test now makes its junctions through the reparse-point API directly, so the maintainer decision the triage asked for is no longer needed either way.make_junction(test-only) creates the empty directory, opens it withCreateFileW(GENERIC_WRITE,FILE_FLAG_BACKUP_SEMANTICS) and sets a mount-point reparse point withDeviceIoControl/FSCTL_SET_REPARSE_POINT(IO_REPARSE_TAG_MOUNT_POINT, substitute name as the NT path\??\<target>, plus the print name) — exactly whatmklink /Jproduces, with no child process. The crate already depends onwindows-sys; this adds theWin32_System_IO,Win32_System_IoctlandWin32_System_SystemServicesfeatures to the existing dependency.Validation on
22a2af9(Windows, CPU-only):cargo test --locked -p victory-hle used_bytes:used_bytes_skips_junctionspassed.cargo test --locked -p victory-hle: 153 passed, 0 failed.cargo clippy --locked -p victory-hle --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.git diff --check: clean.No game data. AI-assisted (Kimi).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.