1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

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
commit 6478f68c5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 8 deletions

View file

@ -30,6 +30,7 @@ uucore = { workspace = true, features = [
"backup-control", "backup-control",
"entries", "entries",
"fs", "fs",
"fsxattr",
"perms", "perms",
"mode", "mode",
"update-control", "update-control",

View file

@ -17,6 +17,8 @@ use std::os::unix::ffi::OsStrExt;
#[cfg(unix)] #[cfg(unix)]
use std::os::unix::fs::{FileTypeExt, PermissionsExt}; use std::os::unix::fs::{FileTypeExt, PermissionsExt};
use std::path::{Path, PathBuf, StripPrefixError}; 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 clap::{builder::ValueParser, crate_version, Arg, ArgAction, ArgMatches, Command};
use filetime::FileTime; use filetime::FileTime;
@ -1605,12 +1607,7 @@ pub(crate) fn copy_attributes(
handle_preserve(&attributes.xattr, || -> CopyResult<()> { handle_preserve(&attributes.xattr, || -> CopyResult<()> {
#[cfg(all(unix, not(target_os = "android")))] #[cfg(all(unix, not(target_os = "android")))]
{ {
let xattrs = xattr::list(source)?; copy_xattrs(source, dest)?;
for attr in xattrs {
if let Some(attr_value) = xattr::get(source, attr.clone())? {
xattr::set(dest, attr, &attr_value[..])?;
}
}
} }
#[cfg(not(all(unix, not(target_os = "android"))))] #[cfg(not(all(unix, not(target_os = "android"))))]
{ {

View file

@ -54,7 +54,7 @@ pub mod process;
#[cfg(all(target_os = "linux", feature = "tty"))] #[cfg(all(target_os = "linux", feature = "tty"))]
pub mod tty; pub mod tty;
#[cfg(all(unix, not(target_os = "macos"), feature = "fsxattr"))] #[cfg(all(unix, feature = "fsxattr"))]
pub mod fsxattr; pub mod fsxattr;
#[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))] #[cfg(all(unix, not(target_os = "fuchsia"), feature = "signals"))]
pub mod signals; pub mod signals;

View file

@ -99,7 +99,7 @@ pub use crate::features::wide;
#[cfg(feature = "fsext")] #[cfg(feature = "fsext")]
pub use crate::features::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; pub use crate::features::fsxattr;
//## core functions //## core functions