diff options
author | Sylvestre Ledru <sylvestre@debian.org> | 2023-09-15 22:34:17 +0200 |
---|---|---|
committer | Sylvestre Ledru <sylvestre@debian.org> | 2023-09-15 22:34:17 +0200 |
commit | 37ee889003509f701e83d33fcb07b9dc30b88aff (patch) | |
tree | a9e09953a432e9617727bcefa9a3cea8c8912cbf /tests/by-util/test_ls.rs | |
parent | 97aa8ae5dbd26ce9f5db8687b4f0e557467eff43 (diff) |
ls -l: show an error when symlink not readable
switching to match and handle the error
Will help with tests/ls/stat-failed.sh
Diffstat (limited to 'tests/by-util/test_ls.rs')
-rw-r--r-- | tests/by-util/test_ls.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index f18150358..5f2b7e443 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -3503,3 +3503,22 @@ fn test_invalid_utf8() { at.touch(filename); ucmd.succeeds(); } + +#[cfg(all(unix, feature = "chmod"))] +#[test] +fn test_ls_perm_io_errors() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + at.mkdir("d"); + at.symlink_file("/", "d/s"); + + scene.ccmd("chmod").arg("600").arg("d").succeeds(); + + scene + .ucmd() + .arg("-l") + .arg("d") + .fails() + .code_is(1) + .stderr_contains("Permission denied"); +} |