ls: fall back to "." metadata for ".." on WASI (#11633)

* ls: fall back to "." metadata for ".." on WASI

On WASI the sandbox blocks access to the parent directory at the
preopened root, causing ls -a to show an error and display ".."
with question marks. Fall back to the current directory metadata
so the entry appears with valid information.
This commit is contained in:
Sylvestre Ledru
2026-04-04 22:21:07 +02:00
committed by GitHub
parent 79209719f9
commit 8c100daa66
3 changed files with 31 additions and 1 deletions
+15
View File
@@ -7133,3 +7133,18 @@ fn test_ls_non_utf8_hidden() {
scene.ucmd().succeeds().stdout_does_not_contain(".hidden");
}
#[test]
#[cfg(target_os = "wasi")]
fn test_ls_a_dotdot_no_error_on_wasi() {
// On WASI the sandbox may block access to ".." at the preopened root.
// ls -a should still succeed and show ".." without an error message.
let scene = TestScenario::new(util_name!());
scene
.ucmd()
.arg("-a")
.arg("-1")
.succeeds()
.stdout_contains("..")
.no_stderr();
}