Skip to content

Commit 31019ce

Browse files
bkuengmattsu2020
authored andcommitted
fsxattr: disable "security.capability" check for bsd
The check was failing with: thread 'features::fsxattr::tests::test_file_has_acl' (134643) panicked at src/uucore/src/lib/features/fsxattr.rs:278:55: called `Result::unwrap()` on an `Err` value: Custom { kind: InvalidInput, error: "no matching namespace" }
1 parent 7cd94a0 commit 31019ce

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/uucore/src/lib/features/fsxattr.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,17 @@ mod tests {
273273
assert!(has_acl(&file_path));
274274
assert!(!has_security_cap_acl(&file_path));
275275

276-
let test_attr = "security.capability";
277-
let test_value = b"";
278-
xattr::set(&file_path, test_attr, test_value).unwrap();
279-
280-
assert!(has_security_cap_acl(&file_path));
276+
// FreeBSD/NetBSD's xattr library does not support the "security" namespace
277+
// (https://github.com/Stebalien/xattr/blob/master/src/sys/bsd.rs#L148).
278+
// However, individual file systems might still implement additional namespaces according to
279+
// https://man.freebsd.org/cgi/man.cgi?query=extattr&sektion=9&manpath=FreeBSD+14.3-RELEASE+and+Ports
280+
#[cfg(not(any(target_os = "freebsd", target_os = "netbsd")))]
281+
{
282+
let test_attr = "security.capability";
283+
let test_value = b"";
284+
xattr::set(&file_path, test_attr, test_value).unwrap();
285+
286+
assert!(has_security_cap_acl(&file_path));
287+
}
281288
}
282289
}

0 commit comments

Comments
 (0)