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
1 change: 1 addition & 0 deletions .vscode/cspell.dictionaries/workspace.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ uutils
sendfile
execfn
fadvise
ficlone
fstatfs
getcwd
mkfifoat
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion src/uu/cp/src/cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
// spell-checker:ignore (ToDO) copydir ficlone fiemap ftruncate linkgs lstat nlink nlinks pathbuf pwrite reflink strs xattrs symlinked deduplicated advcpmv nushell IRWXG IRWXO IRWXU IRWXUGO IRWXU IRWXG IRWXO IRWXUGO sflag
// spell-checker:ignore (ToDO) copydir fiemap ftruncate linkgs lstat nlink nlinks pathbuf pwrite reflink strs xattrs symlinked deduplicated advcpmv nushell IRWXG IRWXO IRWXU IRWXUGO IRWXU IRWXG IRWXO IRWXUGO sflag

use std::cmp::Ordering;
use std::collections::{HashMap, HashSet};
Expand Down
2 changes: 1 addition & 1 deletion src/uu/cp/src/platform/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.
// spell-checker:ignore ficlone reflink ftruncate pwrite fiemap lseek nofollow
// spell-checker:ignore reflink ftruncate pwrite fiemap lseek nofollow

use rustix::fs::{SeekFrom, ftruncate, ioctl_ficlone, seek};
use std::io::Read;
Expand Down
1 change: 1 addition & 0 deletions src/uu/install/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ uucore = { workspace = true, default-features = true, features = [
fluent = { workspace = true }

[target.'cfg(any(target_os = "linux", target_os = "android"))'.dependencies]
rustix = { workspace = true }
selinux = { workspace = true, optional = true }

[features]
Expand Down
5 changes: 5 additions & 0 deletions src/uu/install/src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,11 @@ fn copy_file(from: &Path, to: &Path) -> UResult<()> {
.mode(0o600)
.open(to)?;

#[cfg(any(target_os = "linux", target_os = "android"))]
if rustix::fs::ioctl_ficlone(&dest, &handle).is_ok() {
return Ok(());
}

copy_fast(&mut handle, &mut dest).map_err(|err| {
InstallError::InstallFailed(from.to_path_buf(), to.to_path_buf(), err.to_string())
})?;
Expand Down
Loading