Merge pull request #7003 from sylvestre/use-func

cp: use the function from uucore
This commit is contained in:
Daniel Hofstetter
2024-12-27 08:34:30 +01:00
committed by GitHub
4 changed files with 6 additions and 8 deletions
+1
View File
@@ -30,6 +30,7 @@ uucore = { workspace = true, features = [
"backup-control",
"entries",
"fs",
"fsxattr",
"perms",
"mode",
"update-control",
+3 -6
View File
@@ -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(target_os = "android")))]
use uucore::fsxattr::copy_xattrs;
use clap::{builder::ValueParser, crate_version, Arg, ArgAction, ArgMatches, Command};
use filetime::FileTime;
@@ -1605,12 +1607,7 @@ pub(crate) fn copy_attributes(
handle_preserve(&attributes.xattr, || -> CopyResult<()> {
#[cfg(all(unix, not(target_os = "android")))]
{
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"))))]
{
+1 -1
View File
@@ -54,7 +54,7 @@ pub mod process;
#[cfg(all(target_os = "linux", feature = "tty"))]
pub mod tty;
#[cfg(all(unix, not(target_os = "macos"), feature = "fsxattr"))]
#[cfg(all(unix, feature = "fsxattr"))]
pub mod fsxattr;
#[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))]
pub mod signals;
+1 -1
View File
@@ -99,7 +99,7 @@ pub use crate::features::wide;
#[cfg(feature = "fsext")]
pub use crate::features::fsext;
#[cfg(all(unix, not(target_os = "macos"), feature = "fsxattr"))]
#[cfg(all(unix, feature = "fsxattr"))]
pub use crate::features::fsxattr;
//## core functions