fix(bash): normalized msys paths in ls runtime

Applied brush-core's shell path normalizer in LsRuntime and added an end-to-end Windows regression for listing an MSYS drive alias.

Fixes #8355
This commit is contained in:
roboomp
2026-08-12 19:20:55 +00:00
parent d1b9c55495
commit 87a4cd739c
+19 -1
View File
@@ -3736,7 +3736,8 @@ struct LsRuntime {
impl LsRuntime {
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 { self.cwd.join(path) }
}
@@ -5238,6 +5239,23 @@ mod integration_tests {
assert_eq!(capture.out(), "visible-name\n");
}
#[cfg(windows)]
#[test]
fn resolves_msys_drive_alias_operands() {
let dir = tempfile::tempdir().unwrap();
File::create(dir.path().join("visible-name")).unwrap();
let native = dir.path().to_string_lossy().replace('\\', "/");
let (drive, tail) = native
.split_once(":/")
.unwrap_or_else(|| panic!("expected drive-qualified temp path, got {native:?}"));
let alias = format!("/{}/{}", drive.to_ascii_lowercase(), tail);
let (code, capture) = run_util::<Ls>(&[&alias], "", dir.path());
assert_eq!(code, 0);
assert_eq!(capture.out(), "visible-name\n");
}
#[test]
fn reads_quoting_style_from_the_shell_environment() {
let dir = tempfile::tempdir().unwrap();