mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
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:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user