* added logic to check if we are updating the file and the destination is newer, to skip copying
* corrected logic to handle cp update
* - added test case that mocks the issue described in #7660
- adjusted conditions to satisfy clippy
* typo
* Update src/uu/cp/src/cp.rs
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* Update tests/by-util/test_cp.rs
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
Minor manual cleanup - inlined many format args. This makes the code a bit more readable, and helps spot a few inefficiencies and possible bugs. Note that `&foo` in a `format!` parameter results in a 6% extra performance cost, and does not get inlined by the compiler (yet).
Minor cleanup using clippy autofix. This makes the code a bit more readable, and helps spot a few inefficiencies and possible bugs.
```
cargo clippy --fix --workspace -- -A clippy::all -W clippy::uninlined_format_args && cargo fmt
```
Fix a bug in test_acl_preserve that was causing "setfacl: a: No such file or directory"
error messages when running with `cargo test --features=cp test_acl_preserve`.
Changes:
- Use plus_as_string on path1 to generate the correct absolute path
- Move the file path generation closer to where it's used for better code organization
* Create failing test for #7455
Also update existing test to ensure output is empty.
* add ignore until relevant issue is fixed
---------
Co-authored-by: M Bussonnier <mbussonnier@gmail.com>
* cp: fix verbose output order after prompt
Fixes: #7285
* cp: add test for verbose message order
* cp: fix test for interactive prompt ordering
* cp: update test for verbose output order
* cp: fix test cases to use update option
* cp: make --backup and --no-clobber are mutually exclusive
Should fix tests/cp/cp-i.sh
* simplify the test
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* 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>
* uucore: add update control `none-fail`
* uucore: show suggestion when parse errors occurs because of an ambiguous value
* added tests for fail-none and ambiguous parse error
* uucore: ambiguous value code refractor
* cp: no-clobber fail silently and outputs skipped message in debug
* mv: add --debug support
* minor changes
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>