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

cp: fix cp -f f loop when loop is a symlink loop

Fix: tests/cp/thru-dangling.sh
This commit is contained in:
Sylvestre Ledru 2023-05-02 23:22:13 +02:00
parent 6547bec2ef
commit 832fd2d2c6
2 changed files with 18 additions and 3 deletions

View file

@ -2309,6 +2309,20 @@ fn test_remove_destination_symbolic_link_loop() {
assert!(at.file_exists("loop"));
}
#[test]
#[cfg(not(windows))]
fn test_cp_symbolic_link_loop() {
let (at, mut ucmd) = at_and_ucmd!();
at.symlink_file("loop", "loop");
at.plus("loop");
at.touch("f");
ucmd.args(&["-f", "f", "loop"])
.succeeds()
.no_stdout()
.no_stderr();
assert!(at.file_exists("loop"));
}
/// Test that copying a directory to itself is disallowed.
#[test]
fn test_copy_directory_to_itself_disallowed() {