* 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
```
* Correct chmod -R on dangling symlink and tests
* Add tests of arg-level symlink to chmod
* Add tests of all symlink flag combos on chmod dangling
* Fix no traverse on dangling symlink
* Add chmod recursive tests of default symlink method
* Add default chmod -H flag tests
* Set chmod default traversal method correctly to -H
* Fix arg symlink chmod case
* Remove extra chmod -H testing
---------
Co-authored-by: Clifford Ressel <EMAIL@gmail.com>
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
GNU `seq` doesn't support such large positive exponents anyway,
and we are limited by i64 range, so increase the exponent value
to make sure we fully overflow that range.
Also, add a test to check that a very, very, small number is
treated as 0 (that's also undefined behaviour, but it does
make sense in a way).
The default hex format, on x86(-64) prints 15 digits after the
decimal point, _but_ also trims trailing zeros, so it's not just
a simple default precision and a little bit of extra handling is
required.
Also add a bunch of tests.
Fixes#7364.
When parsing integers, we should still return the min/max value
of the type (depending on the type), and wrap that in the error.
We need to refactor the map function to handle this case better,
and add an extract function to get the value out of an error
(if any).
This fixes the integer part of #7508.