1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

mv: moving dangling symlinks into directories (#8064)

* Fix linting and style issues

* Change condition to not fail for dangling symlinks

The function `move_files_into_dir` had a condition that failed when a
dangling symlink was moved into a folder, which resulted in a file
or directory doesn't exist error

* Added a test case
This commit is contained in:
ALBIN BABU VARGHESE 2025-06-04 11:25:53 -04:00 committed by GitHub
parent c332d96203
commit a7a493a604
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View file

@ -443,6 +443,19 @@ fn test_mv_same_hardlink() {
.stderr_is(format!("mv: '{file_a}' and '{file_b}' are the same file\n"));
}
#[test]
#[cfg(all(unix, not(target_os = "android")))]
fn test_mv_dangling_symlink_to_folder() {
let (at, mut ucmd) = at_and_ucmd!();
at.symlink_file("404", "abc");
at.mkdir("x");
ucmd.arg("abc").arg("x").succeeds();
assert!(at.symlink_exists("x/abc"));
}
#[test]
#[cfg(all(unix, not(target_os = "android")))]
fn test_mv_same_symlink() {