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

Merge pull request #4820 from sylvestre/thru-dangling-2

cp: fix cp -f f loop when loop is a symlink loop
This commit is contained in:
Daniel Hofstetter 2023-05-04 08:20:57 +02:00 committed by GitHub
commit 616a166e36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 95 additions and 6 deletions

View file

@ -2495,6 +2495,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() {