mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-16 19:56:17 +00:00
Merge pull request #2960 from water-ghosts/fix-cp-a-panic
Don't panic when calling cp -a with a nonexistent file
This commit is contained in:
commit
81b2a240e6
2 changed files with 19 additions and 4 deletions
|
@ -43,6 +43,8 @@ static TEST_MOUNT_COPY_FROM_FOLDER: &str = "dir_with_mount";
|
|||
static TEST_MOUNT_MOUNTPOINT: &str = "mount";
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
|
||||
static TEST_MOUNT_OTHER_FILESYSTEM_FILE: &str = "mount/DO_NOT_copy_me.txt";
|
||||
#[cfg(unix)]
|
||||
static TEST_NONEXISTENT_FILE: &str = "nonexistent_file.txt";
|
||||
|
||||
#[test]
|
||||
fn test_cp_cp() {
|
||||
|
@ -1429,3 +1431,16 @@ fn test_copy_through_dangling_symlink() {
|
|||
.fails()
|
||||
.stderr_only("cp: not writing through dangling symlink 'target'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_cp_archive_on_nonexistent_file() {
|
||||
new_ucmd!()
|
||||
.arg("-a")
|
||||
.arg(TEST_NONEXISTENT_FILE)
|
||||
.arg(TEST_EXISTING_FILE)
|
||||
.fails()
|
||||
.stderr_only(
|
||||
"cp: cannot stat 'nonexistent_file.txt': No such file or directory (os error 2)",
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue