From be1115a72248eb3bc22242ebfb0a5f706e69a933 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Tue, 23 Jun 2026 19:19:26 +0900 Subject: [PATCH] mv: use copy_stream for fast cross-device move --- src/uu/mv/Cargo.toml | 1 + src/uu/mv/src/mv.rs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/uu/mv/Cargo.toml b/src/uu/mv/Cargo.toml index c252bb3a36b..b7b42cee7d2 100644 --- a/src/uu/mv/Cargo.toml +++ b/src/uu/mv/Cargo.toml @@ -28,6 +28,7 @@ rustc-hash = { workspace = true } thiserror = { workspace = true } uucore = { workspace = true, features = [ "backup-control", + "buf-copy", "fs", "fsxattr", "perms", diff --git a/src/uu/mv/src/mv.rs b/src/uu/mv/src/mv.rs index 0e6cbaa3657..719a7409ad9 100644 --- a/src/uu/mv/src/mv.rs +++ b/src/uu/mv/src/mv.rs @@ -1310,7 +1310,8 @@ fn rename_file_fallback( & 0o7777; let mut dst_file = create_dest_restrictive(to, /* nofollow */ true) .map_err(|err| io::Error::new(err.kind(), translate!("mv-error-permission-denied")))?; - io::copy(&mut &src_file, &mut dst_file) + // copy_stream has fast-path for Linux + uucore::buf_copy::copy_stream(&mut &src_file, &mut dst_file) .map_err(|err| io::Error::new(err.kind(), translate!("mv-error-permission-denied")))?; #[cfg(not(any(target_os = "macos", target_os = "redox")))]