Commit graph

63 commits

Author SHA1 Message Date
Justin Tracey
2a0d58d060 get android builds to compile and pass tests 2022-04-20 08:44:49 +02:00
Terts Diepraam
18369dc0be all: use array intoiterator 2022-04-05 10:39:31 +02:00
Sam Caldwell
f40fecf86d Add UError impl for clap::Error 2022-03-20 13:50:39 +01:00
Sam Caldwell
efd627bb20 cp: only allow directory for -t 2022-03-20 13:50:39 +01:00
Ryan Gonzalez
2dc3d867d8 cp: Avoid following a destination symlink with -P
Previously, given 'cp -P a b', where 'a' and 'b' were both symlinks, cp
would end up replacing the target of 'b'.

Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
2022-03-14 17:49:42 -05:00
Sylvestre Ledru
63cf0d20b4
Merge branch 'main' into cp-lb 2022-03-03 23:02:57 +01:00
Eli Youngs
eace4bc907
cp: Support copying FIFOs with -r (#3032) 2022-03-03 22:58:27 +01:00
Terts Diepraam
9aca050e4a cp: override args
These arguments should not have been in conflict with each other, but silently override each other.
2022-02-26 10:37:58 +01:00
Sylvestre Ledru
6bf575ad56
Merge branch 'main' into cp-lb 2022-02-20 10:31:13 +01:00
Narasimha Prasanna HN
0379fca260 Fix merge conflict in tests/by-util/test_cp.rs 2022-02-07 23:26:06 +05:30
Sylvestre Ledru
1ac45c9961
Merge pull request #3044 from water-ghosts/cp-dir-vs-file
cp: Fail when copying a directory to a file
2022-02-06 22:01:37 +01:00
Eli Youngs
d50c9c3e77 Fail when copying a directory to a file 2022-02-02 23:59:32 -08:00
Eli Youngs
45751e9e48 cp: Create backup before hardlink 2022-02-01 23:49:39 -08:00
Narasimha Prasanna HN
be6287e3e3 Fix: Avoid infinite recursive copies when source and destination directories are same or source is a prefix of destination 2022-02-02 11:17:53 +05:30
Terts Diepraam
184b65df20 uucore: allow backup suffix with hyphen value 2022-01-31 12:10:57 +01:00
Eli Youngs
71c889116e Fix formatting and unused variable checks 2022-01-30 00:33:06 -08:00
Eli Youngs
680e9081fe Don't panic when calling cp -a with a nonexistent file 2022-01-29 22:59:53 -08:00
Terts Diepraam
2412e4cbf7 add some tests for Clap's InferLongArgs setting 2022-01-29 02:06:32 +01:00
Terts Diepraam
f60c36f242
Merge pull request #2610 from miDeb/cp/abuse
cp: handle edge cases when dest is a symlink
2022-01-11 00:34:55 +01:00
Sylvestre Ledru
59da0d8cd6 cp: add a unit test for issue 1665 2021-12-19 18:19:48 +01:00
electricboogie
a1960f5da0
Fix cp bug: pre-write permission change (#2769) 2021-12-15 22:18:02 +01:00
Thomas Queiroz
c9624725ab
tests: use CmdResult::usage_error 2021-11-09 17:37:05 -03:00
Michael Debertol
3fdff304db cp: handle edge cases when dest is a symlink
- Fail if dest is a dangling symlink
- Fail if dest is a symlink that was previously created by the same
invocation of cp
2021-11-01 22:48:48 +01:00
Sylvestre Ledru
cc8522a2db Fixed a warning on freebdsd:
warning: unused import: `std::os::unix::fs::PermissionsExt`
2021-09-12 23:14:34 +02:00
Sylvestre Ledru
9c22def693 cp: ignore test_no_preserve_mode & test_preserve_mode 2021-09-05 18:54:43 +02:00
Michael Debertol
6a6da71403 cp: add a test for #2631 2021-09-03 14:56:35 +02:00
Michael Debertol
8b74562820 cp: correctly copy mode, ownership, acl and context
Fix a mix-up between ownership and mode. The latter (mode / file permissions)
can also be set on windows (which however only affects the read-only flag),
while there doesn't seem to be a straight-forward way to change file ownership
on windows.

Copy the acl as well when copying the mode. This is a non-default feature and can be
enabled with --features feat_acl, because it doesn't seem to work on CI.
It is only available for unix so far.

Copy the SELinux context if possible.
2021-09-01 00:16:22 +02:00
Michael Debertol
5f2335829a refactor ~ revert to single quotes for "Try '{0 --help'"
This is a test expectation for gnu.
2021-08-14 17:22:09 +02:00
Roy Ivy III
4da46d93c7 tests ~ fix tests for new execution_phrase!() and usage phrasing 2021-08-14 14:01:34 +02:00
Michael Debertol
ce1323ce1c cp: do not set the current directory in tests
Setting the current directory in tests affects other tests, even if the
change is reverted after, because tests are run in parallel.

This should fix the flaky cp tests.
2021-08-12 22:42:40 +02:00
Michael Debertol
9fb927aa85 cp: always delete the destination for symlinks 2021-06-19 18:59:57 +02:00
Michael Debertol
12a1c87cb8 cp: improve symlink handling 2021-06-17 22:26:13 +02:00
Hanif Bin Ariffin
23de181171 Added tests for cp --preserve without args
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-16 11:32:15 +08:00
Roy Ivy III
0dc8c18bac tests ~ fix cargo clippy complaint (clippy::needless_borrow) 2021-06-06 19:28:25 -05:00
Michael Debertol
7ffc7d073c cp: test that file descriptors are closed 2021-06-02 19:21:16 +02:00
Michael Debertol
a323e9cda1 cp: show errors in cow on linux 2021-06-01 23:06:38 +02:00
Roy Ivy III
4e20dedf58 tests ~ refactor/polish spelling (comments, names, and exceptions) 2021-05-31 08:23:57 -05:00
Jan Scheer
3aeccfd802 fix a lot of clippy warnings 2021-05-29 15:11:22 +02:00
Matt Blessed
41bea72f23 cp: fix regressed issue with --backup and -b
- add test for regressed issue
2021-05-26 18:29:03 -04:00
Matt Blessed
25ed5eeb0e cp: move option check to uumain and use show_usage_error
- add test for conflicting options `--backup` and `--no-clobber`
2021-05-26 11:10:04 -04:00
Matt Blessed
a8a1ec7faf cp: implement backup control with tests 2021-05-25 23:22:32 -04:00
Nicolas Thery
4bf33e98a8 cp: add --reflink support for macOS
Fixes #1773
2021-04-24 19:26:15 +02:00
Sylvestre Ledru
5f61848a38 fix a build failure with success() 2021-04-24 12:45:55 +02:00
Sylvestre Ledru
9517395839
Merge pull request #2088 from nthery/cp_reflink_never
cp: add support for --reflink=never
2021-04-24 10:07:41 +02:00
Nicolas Thery
1c5f47efaf use CmdResult methods rather than fields 2021-04-23 07:24:47 +02:00
Jan Scheer
646c6cacbc refactor tests (#1982) 2021-04-23 02:28:46 +02:00
Nicolas Thery
f36832c392 cp: add support for --reflink=never
- Passing `never` to `--reflink` does not raise an error anymore.
- Remove `Options::reflink` flag as it was redundant with
  `reflink_mode`.
- Add basic tests for this option.  Does not check that a copy-on-write
  rather than a regular copy was made.
2021-04-18 18:51:59 +02:00
Gilad Naaman
c5d7f63b3c Make CmdResult::code private 2021-04-17 18:50:41 +03:00
Gilad Naaman
81d42aa2b3 Fix some tests to not use CmdResult fields 2021-04-10 23:30:50 +03:00
Mikadore
b8079098f2 fixed panic! formatting 2021-03-31 13:30:06 +02:00