mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
cp: use the function from uucore
This commit is contained in:
@@ -30,6 +30,7 @@ uucore = { workspace = true, features = [
|
||||
"backup-control",
|
||||
"entries",
|
||||
"fs",
|
||||
"fsxattr",
|
||||
"perms",
|
||||
"mode",
|
||||
"update-control",
|
||||
|
||||
+5
-8
@@ -17,6 +17,8 @@ use std::os::unix::ffi::OsStrExt;
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::fs::{FileTypeExt, PermissionsExt};
|
||||
use std::path::{Path, PathBuf, StripPrefixError};
|
||||
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
|
||||
use uucore::fsxattr::copy_xattrs;
|
||||
|
||||
use clap::{builder::ValueParser, crate_version, Arg, ArgAction, ArgMatches, Command};
|
||||
use filetime::FileTime;
|
||||
@@ -1603,16 +1605,11 @@ pub(crate) fn copy_attributes(
|
||||
})?;
|
||||
|
||||
handle_preserve(&attributes.xattr, || -> CopyResult<()> {
|
||||
#[cfg(all(unix, not(target_os = "android")))]
|
||||
#[cfg(all(unix, not(any(target_os = "android", target_os = "macos"))))]
|
||||
{
|
||||
let xattrs = xattr::list(source)?;
|
||||
for attr in xattrs {
|
||||
if let Some(attr_value) = xattr::get(source, attr.clone())? {
|
||||
xattr::set(dest, attr, &attr_value[..])?;
|
||||
}
|
||||
}
|
||||
copy_xattrs(source, dest)?;
|
||||
}
|
||||
#[cfg(not(all(unix, not(target_os = "android"))))]
|
||||
#[cfg(not(all(unix, not(any(target_os = "android", target_os = "macos")))))]
|
||||
{
|
||||
// The documentation for GNU cp states:
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user