-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(mv): prevent hang when moving directories containing FIFO files #9665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
27b0ce0 to
6ec985d
Compare
|
Is your test really cross-filesystem? See discussion at #8605 (comment) too. |
|
GNU testsuite comparison: |
6ec985d to
f7ef980
Compare
|
okey
these ensures FIFO handling works in both scenarios |
|
Can we remove ignore and just skip on th system |
|
GNU testsuite comparison: |
f7ef980 to
24b49c3
Compare
|
GNU testsuite comparison: |
|
I guess non-cross FS test was added at #7241 . So we need |
|
Oh it has |
|
heh, you want proper test but that require root. something like: #[cfg(unix)]
#[ignore = "requires root for mount"]
#[test]
fn test_mv_dir_with_fifo_cross_filesystem() {
let mut ts = TestScenario::new(util_name!());
let at = &ts.fixtures;
at.mkdir("source");
at.mkfifo("source/pipe");
at.mkdir("mountpoint");
ts.mount_temp_fs(at.plus_as_string("mountpoint")).unwrap();
ts.ucmd()
.args(&["source", "mountpoint/dest"])
.timeout(Duration::from_secs(2))
.succeeds();
} |
d1455d6 to
24b49c3
Compare
|
Merging this might delay... But yeah. And I think we can use GNU >9.9 's test to block regression.
|
|
GNU testsuite comparison: |
|
I guess we can reuse |
|
But that's a big refactor, reusing cp's file type handling would touch many parts of mv. You should create a new issue as enhancement: "mv: share special file handling logic with cp" |
Fixes uutils#9656 When moving a directory containing FIFO files, copy_dir_contents_recursive() would call fs::copy() on the FIFO, causing an indefinite hang. This fix adds FIFO detection before the copy operation and uses make_fifo() instead, matching the behavior of rename_fifo_fallback(). - Add FIFO detection in copy_dir_contents_recursive() - Create new FIFO at destination using make_fifo() - Add test with timeout protection to prevent future regressions
24b49c3 to
1e5bf34
Compare
|
GNU testsuite comparison: |
CodSpeed Performance ReportMerging #9665 will not alter performanceComparing Summary
Footnotes
|
|
To simplify tests: #8605 (comment) |
- Add macOS mount_temp_fs() implementation using hdiutil ramdisk - Refactor test_mv_dir_containing_fifo to use TestScenario infrastructure - Replace platform-specific /dev/shm dependency with portable mount_temp_fs() - Consolidate separate cross-fs and same-fs tests into single test - Add root privilege requirement check - Implement automatic cleanup via Drop trait on all platforms This completes cross-platform test infrastructure: - Linux/FreeBSD/Android: tmpfs mounting (already existed) - macOS: ramdisk creation + HFS+ format + mount (new) Both implementations provide mount_temp_fs()/umount_temp_fs() for cross-device testing without relying on system-specific paths.
b9d9f2b to
68a35de
Compare
|
GNU testsuite comparison: |
Fixes #9656
Adds FIFO detection in
copy_dir_contents_recursive()to prevent indefinite hang when moving directories containing FIFO files. Usesmake_fifo()instead offs::copy().Includes test with timeout protection