From d1b9c55495471c5a130b577b1e95bd1d67512a56 Mon Sep 17 00:00:00 2001 From: roboomp Date: Wed, 12 Aug 2026 19:15:20 +0000 Subject: [PATCH] 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 --- crates/pi-builtins/src/host.rs | 11 ++++++++++- packages/coding-agent/CHANGELOG.md | 4 ++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/crates/pi-builtins/src/host.rs b/crates/pi-builtins/src/host.rs index e76f9e52f..9ab9445e6 100644 --- a/crates/pi-builtins/src/host.rs +++ b/crates/pi-builtins/src/host.rs @@ -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) -> 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. diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index b387e76fd..5a68584b6 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -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