Repository navigation
fix(xla): rename aux.rs so the repository checks out on Windows - #2533
Conversation
`src/lib/mlxcel-xla/src/aux.rs` used the Windows reserved device name AUX, which is reserved with any extension and in any case. Git for Windows refuses to write such a path (core.protectNTFS defaults to true), so the repository could not be cloned or reset on Windows at all. macOS and Linux accept the name, so CI never caught it. Rename the file to `auxiliary.rs` and the module to `auxiliary` (not a `#[path]` shim, so the Rust module name also avoids the reserved word). Every `crate::aux::` import is rewritten, and the `include_str!` path in `src/loading/vlm_gemma_xla_tests.rs` follows the file. The `aux_*.rs` siblings are not reserved names and keep theirs. TECHNICAL_REPORTS is left untouched. Add `scripts/ci/check_windows_reserved_paths.py`, which fails on any tracked path component whose stem (the part before the first dot, case-insensitive) is CON, PRN, AUX, NUL, COM0-9, LPT0-9, or COM/LPT followed by a superscript 1, 2 or 3. Look-alikes such as `aux_manifest.rs`, `console.rs` and `nullable.rs` pass. `check_windows_reserved_paths_test.sh` builds throwaway repos for each case and checks the real tree. A `windows-reserved-paths` CI job runs both, outside the `changes` filter, next to `binary-assets`. Verified with cargo check -p mlxcel-xla --all-targets, cargo test -p mlxcel-xla (363 passed), and both new scripts. The checker run against the tree of origin/main names `src/lib/mlxcel-xla/src/aux.rs`. Closes #2531
Add `make verify-windows-paths`, next to `verify-binary-assets` and listed under Maintenance Targets, so the guard runs locally the same way its sibling does. The name avoids the substring "serve", which the help target's Run Targets filter would otherwise match. Also replace an em dash in the checker's OK message with a colon.
Implementation Review SummaryIntent
Findings AddressedNo CRITICAL or HIGH findings, so no fixes were committed. Remaining Items
Verification
Checked directly: |
The checker's failure text and the CI job comment listed COM0-9 and LPT0-9 but not the COM/LPT plus superscript 1, 2, 3 names the rule also rejects. Decode `git ls-files -z` output as UTF-8 explicitly so matching those names does not depend on the runner's locale.
Security and performance reviewNo CRITICAL or HIGH findings, so no commits were added. Checked and fine:
Not covered by the rule (LOW, not blocking; the guard's stated scope is device names and none of these exist in the tree today):
|
Windows trims trailing spaces from a name's stem, so `aux .txt` opens the AUX device just as `aux.txt` does. Strip them before comparing, and add a `docs/aux .txt` case to the self-test.
Renaming the aux module to auxiliary changed the alphabetical position of `crate::auxiliary` relative to `crate::aux_manifest` and `aux_smoke`, so `cargo fmt -p mlxcel-xla -- --check` failed. This reorders the affected `use` lines and the `mod` declarations in lib.rs. No behavior change. Validation: - cargo fmt -p mlxcel-xla -- --check: clean - bash scripts/ci/check_windows_reserved_paths_test.sh: all cases passed Refs #2531
Summary
src/lib/mlxcel-xla/src/aux.rsused the Windows reserved device name AUX, so Git for Windows could not check the repository out. The file and module are renamed toauxiliary, and a new CI job rejects any tracked path that uses a Windows device name.What changed
git mvofaux.rstoauxiliary.rs,mod auxiliary;inlib.rs, everycrate::aux::import rewritten (11 files, with rustfmt's resulting import reorder), and theinclude_str!path insrc/loading/vlm_gemma_xla_tests.rsupdated. The module is renamed, not aliased with#[path].aux_*.rssiblings keep their names. TECHNICAL_REPORTS is untouched.scripts/ci/check_windows_reserved_paths.py: readsgit ls-files -z(decoded as UTF-8) and fails, listing each path, when a component's stem (before the first dot, trailing spaces removed, case-insensitive) is CON, PRN, AUX, NUL, COM0-9, LPT0-9, or COM/LPT followed by a superscript 1, 2 or 3. Trailing spaces are stripped because Windows trims them, soaux .txtis the AUX device too.scripts/ci/check_windows_reserved_paths_test.sh: throwaway-repo cases that must fail (src/aux.rs,docs/Con.md,a/nul/b.txt,lpt1, plus multi-dot, superscript, and trailing-space names) and must pass (aux_manifest.rs,console.rs,nullable.rs,com10,data.aux,auxiliary.rs), and the real tree.windows-reserved-pathsjob in.github/workflows/ci.ymlafterbinary-assets, outside thechangesfilter, with the same runner,contents: read, andpersist-credentials: falsecheckout.make verify-windows-pathstarget next toverify-binary-assets, listed under Maintenance Targets inmake help. The name avoids "reserved" because the help target's Run Targets filter matches the substring "serve".Out of scope
Other names Windows cannot create (
<>:"|?*, backslashes, control characters, components ending in a dot or space, case-only collisions) are not checked; the guard covers device names as the issue specifies.Test plan
cargo check --all-targets(root crate)cargo check -p mlxcel-xla --all-targetsandcargo fmt -p mlxcel-xla -- --checkcargo test -p mlxcel-xla(363 passed)python3 scripts/ci/check_windows_reserved_paths.pypasses on this branch and namessrc/lib/mlxcel-xla/src/aux.rson the tree oforigin/mainbash scripts/ci/check_windows_reserved_paths_test.sh(16 cases plus the real tree)git grepfor remainingaux::andaux.rsreferences outside TECHNICAL_REPORTS finds nonexla-iree-gated test containing theinclude_str!could not be built locally (needsIREE_DIST); the target path was checked by hand, and thexla-compileCI job compiles it withcargo check --features cuda,xla-iree --all-targetsgit cloneon Windows completes andgit statusis cleanCloses #2531