Repository navigation
fix(vfs): keep VFS paths slash-separated on Windows - #2936
Merged
Merged
Conversation
On Windows, `echo x > /dev/stderr` wrote a VFS file: dev_fd_alias re-normalized the target with PathBuf::push, producing /dev\stderr, which missed the device match (#2933). Use the shared normalize_path. A clippy run with host-separator joins banned found the rest of the class: PosixFs mkdir -p parent checks (backend saw /a\b), cd x/.., readlink -f prefix probes, OverlayFs upper-dir counting, and git refs/heads paths. All now use vfs_join. Guard against a third sweep: crates/bashkit/clippy.toml bans Path::join, PathBuf::push, set_file_name and with_file_name, with scoped allows for host-path code. testing::CheckedFs records the paths a filesystem receives; Windows CI now runs the device-path and separator integration tests. Public custom-fs examples no longer teach the push pattern. Closes #2933
The new Windows CI step runs dev_fd_path_tests; on windows-latest `bash` is the WSL launcher, which prints a UTF-16 notice instead of running the script. Bashkit's own output assertions still run on every host.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | 6813cf2 | Commit Preview URL Branch Preview URL |
Nov 18 2026, 06:07 PM |
This was referenced Nov 18, 2026
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.
Requested by Михайло · project thread
What changed
/dev/stdout,/dev/stderr,/dev/stdinand/dev/fd/Nare handled by the interpreter again, as on Linux, instead of being written to the VFS as regular files (closes Windows: redirect to /dev/stdout or /dev/stderr goes to the file system #2933).mkdir -pparent checks inPosixFs,cd x/..,readlink -fprefix probes,OverlayFsupper-dir counting, andgitrefs/heads/<name>paths. CustomFileSystem/FsBackendimplementations on Windows no longer receive\-joined paths like/a\b.crates/bashkit/clippy.tomlbansPath::join,PathBuf::push,PathBuf::set_file_nameandPath::with_file_namein thebashkitcrate. Host-path code (RealFs, host mounts, test/bench/example temp paths) opts out with a scoped#[allow]and a reason.bashkit::testing::CheckedFs: aFileSystemwrapper that records every path received and flags\. Newvfs_separator_testsrun device redirects,mkdir -p,cd ..andreadlink -fthrough it.test-windows) now also runs the integrationwindows_containment,dev_fd_path_testsanddev_null_testsfilters; new lib tests namedwindows_containment_*are picked up by the existingwindows-containmentjob.custom_backendandcustom_filesystem_implexamples no longer teach thePathBuf::pushnormalizer; they callbashkit::normalize_path/vfs_join.Why
normalize_dev_pathrebuilt the already-clean path withPathBuf::push, which joins with the host separator, so on Windows/dev\stderrmissed the string match. This is the second sweep of this class after #2425. Fuzzing and Linux CI cannot see it because the Linux separator already is/, so the fix adds a compile-time ban instead of relying on another sweep. A trial run of the ban is what found the other sites.Before / After
Before (Windows):
echo hi > /dev/stderr→ empty stderr, VFS file/dev/stderrcreated; a string-keyed custom backend seesstat("/a\b")duringmkdir -p /a/b/c.After: output lands on stderr, no VFS write.
CheckedFsand the backend recorder see only/-joined paths. Linux behavior is unchanged.Local (Linux):
just pre-prgreen (fmt, clippy--all-targets --all-features -D warningswith the new ban, tests, vet).cargo test -p bashkit --lib -- windows_containment12 pass,--test integration -- windows_containment dev_fd_path_tests dev_null_tests51 pass. The Windows-specific failure mode is only exercisable on the Windows runner.Risk
#[allow]on future legitimate host-path code.Checklist
🤖 Generated with Claude Code