mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-15 11:36:16 +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:
commit
616a166e36
7 changed files with 95 additions and 6 deletions
|
@ -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() {
|
||||
|
|
|
@ -72,7 +72,7 @@ fn test_mv_move_file_into_dir_with_target_arg() {
|
|||
.succeeds()
|
||||
.no_stderr();
|
||||
|
||||
assert!(at.file_exists(format!("{dir}/{file}")))
|
||||
assert!(at.file_exists(format!("{dir}/{file}")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -90,7 +90,7 @@ fn test_mv_move_file_into_file_with_target_arg() {
|
|||
.fails()
|
||||
.stderr_is(format!("mv: target directory '{file1}': Not a directory\n"));
|
||||
|
||||
assert!(at.file_exists(file1))
|
||||
assert!(at.file_exists(file1));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue