mv: handle FIFOs inside directories during cross-partition move (#10857)

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
This commit is contained in:
Chris Dryden
2026-02-11 04:59:10 -05:00
committed by GitHub
parent 7df7e7342e
commit 651af77365
2 changed files with 30 additions and 0 deletions
+2
View File
@@ -1141,6 +1141,8 @@ fn copy_file_with_hardlinks_helper(
if from.is_symlink() {
// Copy a symlink file (no-follow).
rename_symlink_fallback(from, to)?;
} else if is_fifo(from.symlink_metadata()?.file_type()) {
make_fifo(to)?;
} else {
// Copy a regular file.
fs::copy(from, to)?;
+28
View File
@@ -2444,6 +2444,34 @@ mod inter_partition_copying {
"nested content"
);
}
#[test]
#[cfg(unix)]
pub(crate) fn test_mv_dir_with_fifo_across_partitions() {
use std::os::unix::fs::FileTypeExt;
use tempfile::TempDir;
use uutests::util::TestScenario;
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.mkdir("dir");
at.mkfifo("dir/fifo");
let other_fs_tempdir =
TempDir::new_in("/dev/shm/").expect("Unable to create temp directory in /dev/shm");
scene
.ucmd()
.arg("dir")
.arg(other_fs_tempdir.path().to_str().unwrap())
.succeeds()
.no_output();
assert!(!at.dir_exists("dir"));
let moved_fifo = other_fs_tempdir.path().join("dir/fifo");
assert!(moved_fifo.symlink_metadata().unwrap().file_type().is_fifo());
}
}
#[test]