xtask: preserve filenames during asset-policy checks #2581
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!2581
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2581"
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?
@XeNS1 on GitHub · 2026-11-25 16:10 UTC · original
XeNS1:codex/xtask-policy-filenames-20261125→main· +117 −13 · 3 files · 1 commits · openClaimed as: XTASK-POLICY-FILENAME-FIDELITY
#1633
Problem and change
On POSIX,
literal\name.rsis a legal filename. Asset-policy enumeration changed the backslash into/, so it inspectedliteral/name.rsinstead. If that path was absent, the check skipped the contents; if it held clean text, it checked the wrong file. Non-UTF-8 filenames were similarly replaced with a different name by lossy decoding. The policy could report success while a synthetic NUL-bearing file went unchecked.Keep Git's UTF-8 paths verbatim: Git already emits
/directory separators. For source trees without Git, normalize only the native directory separator. Refuse non-UTF-8 filenames explicitly rather than substituting a name that can identify another file.Add temporary-file regressions for Git worktree/untracked scans, staged content, source exports without
.git, literal backslashes, invalid UTF-8 names and Unicode controls. The controls also verify that staged mode reads the index rather than unstaged worktree contents. Every binary test input is a generated single NUL byte in a temporary directory; no game files are used.tempfileis an existing workspace dependency, added only as an xtask dev-dependency. No dependency versions change.Validation
Linux x86-64, Rust/Cargo 1.100.0; 2 test/build workers:
cargo test -p xtask --locked --offline -j 2 -- --test-threads=2: 9 passed.cargo clippy -p xtask --all-targets --all-features --locked --offline -j 2 -- -D warnings: passed.cargo fmt --package xtask -- --check: passed.cargo run --quiet --locked --offline -p xtask -- policy: 184 files passed.policy --staged: exactly the three changed files passed.git diff --check: passed.The pinned Rust 1.98.1 and native Windows were not tested locally. POSIX-only filename cases are gated with
cfg(unix); the ordinary Unicode/index regression also runs on Windows. The whole Windows runtime workspace and game were not run.Related: #2246 changes the same policy file for decimal-array detection; #2166 adds CPU verification tooling. Their behavior is outside this change. Depends on: none.
GPUs tested: n/a, CPU-only filesystem/Git checks.
AI-assisted: OpenAI Codex.
@oni-swr on GitHub · 2026-11-25 16:33 UTC · original
oni-swr verification — head
2c13b1c48dea5db6bb12a364b39bce4ea9ac1b9e,origin/main67e8ae1401df112248aed36d0024483181b718b7Environment: Windows 11 Pro (26200), rustc 1.98.1, CPU only (no GPU involved, no game files). Merge check:
git merge-tree --write-tree origin/main <head>is clean.Commands / results
cargo test --locked -p xtask: 7 passed, 0 failed, 0 ignored (incl.ordinary_unicode_paths_are_checked_in_both_modesandrepository_passes_policy).literal_backslashes_do_not_hide_file_contentsandnon_utf8_names_are_refused_instead_of_substitutedare#[cfg(unix)], so they were compiled out, not run here, and NTFS cannot create such filenames anyway. Those two paths are therefore unverified by me and need a Linux/macOS run (CI).Review: the git branch now uses the NUL-separated names as-is (git already emits
/) and fails loudly on non-UTF-8 instead offrom_utf8_lossy+\replacement; the walkdir branch errors on a non-UTF-8 relative path and only normalizesMAIN_SEPARATOR(so on POSIX a literal\stays in the name).tempfileis a dev-dependency only;Cargo.lockchange matches. Behaviour on Windows is unchanged for ordinary names. I found no defects.Overlap: none; no other open PR touches
xtask.AI disclosure: this review and verification were done by Claude Code (Claude Sonnet 5.5), not a human reviewer. Comment-only; no code changed.
@Marvisak on GitHub · 2026-11-25 22:19 UTC · original
Automated triage for the maintainers.
Needs the maintainer's decision. The change tightens
xtask/src/policy.rsand does not loosen it.list_fileskeeps git's NUL-separated names verbatim instead of turning\into/and decoding lossily, the walkdir fallback normalises onlyMAIN_SEPARATOR, and non-UTF-8 names now fail the check instead of being replaced by another name. By my reading this is correct, and the tests generate their inputs (single NUL bytes) in temp dirs. It merges cleanly and CI (check) passes, but the twocfg(unix)tests do not run on the Windows CI.It adds
tempfileas a dev-dependency ofxtask(xtask/Cargo.toml,Cargo.lock), and its tests spawngitprocesses. Dependency changes and process spawning are left to the maintainer, so this cannot be marked a merge candidate by triage. Nothing is needed from the author unless the maintainer asks.Generated by Claude Code
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.