Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ feat_systemd_logind = [
"uucore/feat_systemd_logind",
"who/feat_systemd_logind",
]
# "feat_acl" == enable support for ACLs (access control lists; by using`--features feat_acl`)
# NOTE:
# * On linux, the posix-acl/acl-sys crate requires `libacl` headers and shared library to be accessible in the C toolchain at compile time.
# * On FreeBSD and macOS this is not required.
feat_acl = ["cp/feat_acl"]
# "feat_selinux" == enable support for SELinux Security Context (by using `--features feat_selinux`)
# NOTE:
# * The selinux(-sys) crate requires `libselinux` headers and shared library to be accessible in the C toolchain at compile time.
Expand Down
3 changes: 1 addition & 2 deletions src/uu/cp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ rustix = { workspace = true }
selinux = { workspace = true, optional = true }

[target.'cfg(unix)'.dependencies]
exacl = { workspace = true, optional = true }
nix = { workspace = true, features = ["fs"] }
xattr = { workspace = true }

[target.'cfg(target_os = "windows")'.dependencies]
windows-sys = { workspace = true, features = [
Expand All @@ -68,4 +68,3 @@ harness = false

[features]
feat_selinux = ["selinux", "uucore/selinux"]
feat_acl = ["exacl"]
7 changes: 1 addition & 6 deletions src/uu/cp/src/cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1884,18 +1884,13 @@ pub(crate) fn copy_attributes(

fs::set_permissions(dest, source_perms)
.map_err(|e| CpError::IoErrContext(e, context.to_owned()))?;
// FIXME: Implement this for windows as well
#[cfg(feature = "feat_acl")]
exacl::getfacl(source, None)
.and_then(|acl| exacl::setfacl(&[dest], &acl, None))
.map_err(|err| CpError::Error(err.to_string()))?;
// GNU `cp -p` preserves POSIX ACLs as part of mode. On Linux the
// ACLs are stored as `system.posix_acl_*` xattrs; copy just those
// so we keep ACL parity with GNU without preserving user xattrs
// (which are intentionally excluded from the default -p set per
// issue #9704). Best-effort: ignore failures on filesystems that
// do not support ACL xattrs.
#[cfg(all(unix, not(target_os = "android")))]
#[cfg(all(unix, not(target_os = "android")))] // todo: support acl for other targets
copy_acls(source, dest);
}

Expand Down
Loading