mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
cp: show errors in cow on linux
This commit is contained in:
parent
3cf966810f
commit
a323e9cda1
2 changed files with 23 additions and 2 deletions
|
@ -7,6 +7,8 @@ use std::fs::set_permissions;
|
|||
#[cfg(not(windows))]
|
||||
use std::os::unix::fs;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
#[cfg(windows)]
|
||||
use std::os::windows::fs::symlink_file;
|
||||
|
||||
|
@ -1257,3 +1259,20 @@ fn test_cp_reflink_bad() {
|
|||
.fails()
|
||||
.stderr_contains("invalid argument");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn test_cp_reflink_insufficient_permission() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
||||
at.make_file("unreadable")
|
||||
.set_permissions(PermissionsExt::from_mode(0o000))
|
||||
.unwrap();
|
||||
|
||||
ucmd.arg("-r")
|
||||
.arg("--reflink=auto")
|
||||
.arg("unreadable")
|
||||
.arg(TEST_EXISTING_FILE)
|
||||
.fails()
|
||||
.stderr_only("cp: 'unreadable' -> 'existing_file.txt': Permission denied (os error 13)");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue