Repository navigation
sandbox: match a --layer name's non-ASCII letters in any case on Windows - #2241
Merged
Pedro Henrique Penna (ppenna) merged 1 commit intoNov 27, 2026
Merged
Conversation
On Windows, sandbox run and provision refused a distro layer whose --layer path spelled a non-ASCII letter of the layer's file name in another case than its manifest's artifact field, such as DIR\couche-É.erofs for DIR\couche-é.erofs, whose manifest names couche-é.erofs. They failed with "sandbox distro manifest does not match its artifact" before they compared the digest (#2240), although NTFS ignores the case of non-ASCII letters too, so the layer and its manifest opened through that spelling. A spelling that differs only in the case of ASCII letters, which #2131 fixed, already passed. Explicit verification compares the artifact with the layer's file name through host::paths::is_named, which on Windows compared the names with OsStr::eq_ignore_ascii_case. That folds the case of ASCII letters alone, while Windows' own lookups ignore the case of every letter that the operating system's uppercase table maps. On Windows, is_named now compares the names with CompareStringOrdinal, ignoring case, through a new platform helper, is_same_file_name: the comparison that uses the operating system's uppercase table, as the file system does, rather than case folding in user space. Elsewhere it still compares names exactly. A manifest that names another artifact, such as couche-è.erofs, still fails, and root discovery, the other caller, compares names with bin, nvx, and target, whose matches do not change. The documentation that said "in any ASCII case" now says any case. windows-sys gains its Win32_Globalization feature, which declares the function. Evidence, on a local Windows 11 workstation (NTFS), with the CLI and no VM, since no configured WHP host was reachable: at 2e30219, sandbox provision --upper ram with --layer DIR\couche-É.erofs exited with 1 and the error above, and sandbox run --dry-run failed the same way, while the exact and the ASCII-case spellings provisioned. With the fix, all three spellings provision, the run goes on to its artifact checks, and a manifest that names couche-è.erofs is still refused. Tests: on Windows, the verification of a layer through a path that spells a non-ASCII letter of its name in another case fails at 2e30219 and passes with the fix; the test also checks that a manifest of another letter is still refused. Refs #2240. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the Windows non-ASCII layer-name matching change.
No open issues 🎉
What changed in this PR
Fixes #2240 by extending Windows sandbox layer-name verification to accept non-ASCII case differences. This builds on #2138’s ASCII-only fix while preserving exact matching on Linux and macOS and leaving digest verification unchanged.
Changes:
- Uses Windows
CompareStringOrdinalfor case-insensitive name matching and enables the requiredwindows-sysfeature. - Adds a Windows regression test accepting
é/Éwhile rejecting a different letter. - Updates documentation to describe non-ASCII case matching.
| File | Description |
|---|---|
nvx/src/host/sandbox/distro/tests.rs |
Tests non-ASCII case acceptance and mismatched-name rejection. |
nvx/src/host/sandbox/distro.rs |
Updates verification documentation to remove the ASCII-only limitation. |
nvx/src/host/platform/windows/mod.rs |
Adds the Windows name-comparison helper using the operating system’s uppercase table. |
nvx/src/host/paths.rs |
Routes Windows name matching through the new helper; retains exact matching elsewhere. |
nvx/README.md |
Updates the documented distro-binding name comparison. |
nvx/Cargo.toml |
Enables windows-sys’s Win32_Globalization feature. |
doc/run.md |
Documents non-ASCII case differences in --layer names on Windows. |
Review effort: Balanced
Pedro Henrique Penna (ppenna)
deleted the
agents/issue-2240-layer-name-unicode-case
branch
November 27, 2026 07:38
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2240
What does this pull request change?
On Windows,
nvx sandbox runandnvx sandbox provisionnow accept a distrolayer whose
--layerpath spells a non-ASCII letter of the layer's file name inanother case than the manifest's
artifactfield, such as--layer distro,DIR\couche-É.erofs,UUIDforDIR\couche-é.erofs, whosemanifest names
couche-é.erofs. Before, they failed witherror[unsupported]: sandbox distro manifest does not match its artifact,although Windows opens the layer and its manifest through that spelling. A
manifest that names another artifact, such as
couche-è.erofs, is stillrefused, and the digest still binds the manifest to the layer's bytes.
host::paths::is_named, which explicit verification uses to compare themanifest's
artifactwith the layer's file name, now compares names onWindows with
CompareStringOrdinal, ignoring case through the operatingsystem's uppercase table, through a new helper of the Windows platform layer,
is_same_file_name. It still compares names exactly elsewhere, so Linux andmacOS are unchanged.
windows-sysgains itsWin32_Globalizationfeature, which declares thefunction;
Cargo.lockdoes not change.nvx/src/host/paths.rs,nvx/src/host/sandbox/distro.rs, the README'sDistro bindings, and
doc/run.md.Start with
is_same_file_nameinnvx/src/host/platform/windows/mod.rs, thenis_namedinnvx/src/host/paths.rs, then the test innvx/src/host/sandbox/distro/tests.rs.Left out, and limitations that remain: root discovery, the other caller of
is_named, compares path components only withbin,nvx, andtarget, soits matches do not change. The comparison ignores case even in a directory
whose per-directory case sensitivity is enabled, as the ASCII comparison did,
and it uses the operating system's uppercase table, which may differ from that
of a volume that an older Windows formatted for letters that the newer table
added. An 8.3 short-name spelling, such as
COUCHE~1.ERO, already provisioned,since no manifest opens beside it and
provisionverifies the layer again atits resolved long path.
Why is this change needed?
Root cause: explicit verification,
verify_with,compares the
artifactwith the file name of the path given throughpaths::is_named,which on Windows called
OsStr::eq_ignore_ascii_case: it folded the case ofASCII letters alone, while Windows' own lookups, which found the layer and its
manifest through that spelling, ignore the case of every letter that the
uppercase table maps, such as
éandÉ. #2138, the fix of #2131, introducedthe ASCII-only comparison. A user or script that spells a layer's name with a
non-ASCII letter in another case cannot run or provision a sandbox from it,
and
snapshot restoreshares the code path.Alternatives rejected:
char::to_uppercase: its full mappingsover-match (
ßbecomesSS, which Windows does not match), and its Unicodeversion need not be the operating system's. OpenVMM's fix of openvmm: virtiofs: Windows case-insensitive lookup and NTFS 8.3 short names bypass microVM SubtreePolicy #1603 (openvmm: pin the Windows name checks of microVM shares #1963)
rejected user-space case folding for the same reason.
artifactin the layer's directory opens the layer, by fileidentity: exact under per-directory case sensitivity, but it changes what
"names the layer" means on every host, so that hard links and symbolic links
would match too, and it opens a path that the manifest names.
manifest may still spell that name in another case, so it needs the same
case-insensitive comparison.
How was this change validated?
Checks and results:
cargo test --locked --all-features --lib -- host::sandbox::distro::tests::verification_takes_the_manifeston Windows: at
2e302197d90with the test alone, the newverification_takes_the_manifest_of_a_layer_whose_path_spells_a_non_ascii_letter_in_another_casefailed with
called Result::unwrap() on an Err value: Error { code: Unsupported, message: "sandbox distro manifest does not match its artifact", source: None },while nvx: on Windows, sandbox run and provision refuse a distro layer whose --layer path spells its file name in another case #2131's ASCII test passed. With the fix, both pass, and the 24 tests of
host::sandbox::distro,host::paths, andhost::cli::artifactspass.nvxCLI and no VM: at2e302197d90,sandbox provision --upper ramexited with 0 for the exact and theASCII-case spellings and with 1 and the error above for the non-ASCII-case
spelling, and
sandbox run --dry-runfailed the same way. With the fix, allthree spellings provision (the non-ASCII one records the on-disk name), the
run goes on to its artifact checks (
artifact-missingin a checkout withoutartifacts), and a manifest that names
couche-è.erofsstill fails withexit 1.
python scripts\local_gates.py --base origin/dev --runon Windows, withNVXnaming a release build and Git'susr\binonPATH: test-changes,markdown-links, test-layout, nvx-format, nvx-lint, nvx-test, nvx-doc,
nvx-msrv, and nvx-cli passed.
cargo clippy --locked --target x86_64-unknown-linux-gnuwith--all-targets --all-features,--lib --bins --features cli, and--lib,each with
-D warnings: passed.cargo check --locked --all-targets --all-features --target aarch64-apple-darwin: passed.Backend, host OS, host type, and guest:
azure-intel-whp-1to-7,-11,-12, andazure-amd-whp-1to-4were unreachableNo guest ran: the change is in the CLI's verification before any launch.
Left to CI, and passed there: run
45938019508 of
055c4a335d5passed the Linux and Windows jobs of thenvxcrate, includingits tests on Linux, whose behavior is unchanged, the NVX CLI on Linux and
Windows, the guest and OpenVMM builds, and the microVM tests on KVM, MSHV, and
WHP; the public API check ran there too.
Checklist
python3 scripts/check_test_layout.pychecks.python3 scripts/check_test_changes.py --base origin/devlists no changeto an existing test, or a Changes to existing tests section below
explains each one.
.github/copilot-instructions.mdand the skills when a convention orworkflow changes.
nvxupdatesnvx/public-api/withpython3 scripts/public_api.py --update.description says how the change versions or migrates them.