mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
* cp: show mode if target does not have S_IWUSR If the target exists, and does not have the user write bit (S_IWUSR) set, additional information should be added to the overwrite confirmation prompt. This should get the "i-2" test to pass. See https://github.com/uutils/coreutils/issues/6658. * cp: with -i, delete destination if needed --------- Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
This commit is contained in:
parent
564dd47297
commit
b8150f5ba5
2 changed files with 165 additions and 39 deletions
|
@ -600,6 +600,41 @@ fn test_cp_arg_interactive_verbose_clobber() {
|
|||
.stdout_contains("skipped 'b'");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_cp_f_i_verbose_non_writeable_destination_y() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
||||
at.touch("a");
|
||||
at.touch("b");
|
||||
|
||||
// Non-writeable file
|
||||
at.set_mode("b", 0o0000);
|
||||
|
||||
ucmd.args(&["-f", "-i", "--verbose", "a", "b"])
|
||||
.pipe_in("y")
|
||||
.succeeds()
|
||||
.stderr_is("cp: replace 'b', overriding mode 0000 (---------)? ")
|
||||
.stdout_is("'a' -> 'b'\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_cp_f_i_verbose_non_writeable_destination_empty() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
||||
at.touch("a");
|
||||
at.touch("b");
|
||||
|
||||
// Non-writeable file
|
||||
at.set_mode("b", 0o0000);
|
||||
|
||||
ucmd.args(&["-f", "-i", "--verbose", "a", "b"])
|
||||
.pipe_in("")
|
||||
.fails()
|
||||
.stderr_only("cp: replace 'b', overriding mode 0000 (---------)? ");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn test_cp_arg_link() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue