fix(bash): resolved msys drive paths in utility builtins

Normalized utility operands through brush-core's shared shell path resolver so /c and /mnt/c aliases address the live Windows drive. Added Windows-only regression coverage at the Host boundary.

Fixes #8355
This commit is contained in:
roboomp
2026-08-12 19:15:20 +00:00
parent 06aecdd51f
commit d1b9c55495
2 changed files with 14 additions and 1 deletions
+10 -1
View File
@@ -119,7 +119,8 @@ impl Host {
/// filesystem: the host process's current directory is unrelated to the
/// shell's.
pub fn resolve(&self, path: impl AsRef<Path>) -> PathBuf {
let path = path.as_ref();
let normalized_path = brush_core::sys::fs::normalize_shell_path(path.as_ref());
let path = normalized_path.as_ref();
if path.is_absolute() {
path.to_path_buf()
} else {
@@ -869,6 +870,14 @@ mod testing {
}
}
#[cfg(windows)]
#[test]
fn resolves_msys_drive_aliases_to_native_drive() {
let (host, _) = Host::for_test("test", "", r"C:\workspace");
assert_eq!(host.resolve("/c/Users/Adam/file.txt"), PathBuf::from(r"C:\Users\Adam\file.txt"));
}
/// Parses `argv` and runs `U` against an in-memory host, mirroring what the
/// registered builtin does: `argv[0]` is the command name, clap failures are
/// reported the same way, and panics are contained.
+4
View File
@@ -2,6 +2,10 @@
## [Unreleased]
### Fixed
- Fixed bash utility builtins resolving MSYS-style `/c/...` paths against a phantom rooted path instead of the live Windows drive, preventing stale reads and lost writes ([#8355](https://github.com/can1357/oh-my-pi/issues/8355)).
## [17.2.15] - 2026-08-12
### Added