1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

Merge pull request #8217 from sudhackar/ls-fix

ls: follow symlinks for xattrs, fix #8216
This commit is contained in:
Sudhakar Verma 2025-06-19 13:47:25 +05:30 committed by GitHub
parent 86f0c617d8
commit c674cf1839
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 43 additions and 5 deletions

View file

@ -5716,3 +5716,40 @@ fn test_unknown_format_specifier() {
.succeeds()
.stdout_matches(&re_custom_format);
}
#[cfg(all(unix, not(target_os = "macos")))]
#[test]
fn test_acl_display_symlink() {
use std::process::Command;
let (at, mut ucmd) = at_and_ucmd!();
let dir_name = "dir";
let link_name = "link";
at.mkdir(dir_name);
// calling the command directly. xattr requires some dev packages to be installed
// and it adds a complex dependency just for a test
match Command::new("setfacl")
.args(["-d", "-m", "u:bin:rwx", &at.plus_as_string(dir_name)])
.status()
.map(|status| status.code())
{
Ok(Some(0)) => {}
Ok(_) => {
println!("test skipped: setfacl failed");
return;
}
Err(e) => {
println!("test skipped: setfacl failed with {e}");
return;
}
}
at.symlink_dir(dir_name, link_name);
let re_with_acl = Regex::new(r"[a-z-]*\+ .*link").unwrap();
ucmd.arg("-lLd")
.arg(link_name)
.succeeds()
.stdout_matches(&re_with_acl);
}