1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00
Commit graph

289 commits

Author SHA1 Message Date
Luv-Ray
69bc6a791e
cp: clean existing file when copy from stream (#8149)
* cp: clean existing file when copy from stream

* cp: remove outdated comments

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-07-06 16:07:22 +02:00
Daniel Hofstetter
546e50846e cp: rewrite test to remove procfs dependency 2025-06-02 09:51:33 +02:00
Daniel Hofstetter
8674e86703 cp: fix warnings from unnecessary_debug_formatting
Co-authored-by: Jeremy Smart <jeremy3141592@gmail.com>
2025-05-19 09:54:37 +02:00
Sylvestre Ledru
832dd495bf selinux: adjust more error messages 2025-05-07 22:58:46 +02:00
Sylvestre Ledru
5148ba12d6 set_selinux_security_context: also display the error from the crate
+ fix comments from review
2025-05-06 08:52:27 +02:00
Sylvestre Ledru
b3a2b74ca1 cp/selinx: improve the support of --preserve-context and simplify the code.
+ Add test for the selinux changes with context SLASHLogin
Improves the coverage of tests/cp/cp-a-selinux.sh
2025-05-06 08:52:27 +02:00
Sylvestre Ledru
e7fdd3dfba selinux: add support in cp 2025-05-06 08:52:27 +02:00
Daniel Hofstetter
cd3c921d1e
cp: copy dir if source path ends with dot (#7874) 2025-05-04 09:31:34 +02:00
Dan Hipschman
e92e419a93 cp: refuse to copy symlink over itself 2025-04-28 09:56:43 +02:00
Sylvestre Ledru
4a94a4e1dc spell: add getfattr in the ignore list 2025-04-24 21:54:29 +02:00
Dan Hipschman
d37f500bd3 cp: cp -P hardlink-to-symlink hardlink-to-same-symlink should noop 2025-04-14 13:06:53 +02:00
hz2
cd2b56ea9c
cp: fix update prompting (#7668)
* 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>
2025-04-10 19:00:39 +02:00
Yuri Astrakhan
170831ed2b chore: remove unneeded parens
Keeps code a bit more readable
2025-04-08 18:19:03 -04:00
Daniel Hofstetter
a77e218a79
Merge pull request #7690 from nyurik/manual-inline
chore: manual inline formatting - tests
2025-04-08 15:27:14 +02:00
Daniel Hofstetter
7f8ad6a32c
Merge pull request #7688 from nyurik/fmt-inline
chore: use inline formatting
2025-04-08 09:31:17 +02:00
Yuri Astrakhan
3dc771924c chore: cleanup trailing commas before parens
Deleted commas in cases like `foo,)` -- mostly in macros
2025-04-08 00:33:58 -04:00
Yuri Astrakhan
982805d3cd chore: manual inline formatting
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).
2025-04-08 00:23:21 -04:00
Yuri Astrakhan
47b10539d0 chore: use inline formatting
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
```
2025-04-07 22:56:21 -04:00
shskwmt
58bde5453d test/cp: Fix "No such file or directory" error in test_acl_preserve
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
2025-04-06 23:50:14 +09:00
Daniel Hofstetter
a8a43f73b0 clippy: fix errors from unnecessary_semicolon lint 2025-04-03 14:24:16 +02:00
Sylvestre Ledru
a0179ea239 uutests: adjust the tests to use them 2025-03-28 21:40:31 +01:00
Sylvestre Ledru
a85539f530 Run cargo fmt on the tree 2025-03-24 21:33:12 +01:00
M Bussonnier
5532891f20
cp: create failing test for #7455 (#7457)
* 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>
2025-03-16 15:31:06 +01:00
Sylvestre Ledru
18cb7dcf9e Use the new function fails_with_code
Done with
```
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.no_stdout\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2)\n\1.no_stdout();/gs' *rs
$ sed -i -e "s|.fails()(.*).code_is(|.fails_with_code(|g" *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2);/gs' *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)(.*?)[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\3)\2;/gs' *rs
...
```
2025-03-01 17:26:20 +01:00
Thomas Kilian
63fe4fb327 cp: disabled verbose output if file has been skipped 2025-02-24 22:24:27 +01:00
aimerlief
dd7b45465c
cp: print verbose msg after prompt (#7287)
* 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
2025-02-11 09:19:08 +01:00
sreehari prasad
c2505841e0
Tests: provides easy mount of temp fs (#7249) 2025-02-01 19:01:49 +01:00
Sylvestre Ledru
8c201c1779 tests/cp: Decrease more sleep 2025-01-31 09:56:47 +01:00
Sylvestre Ledru
f00a8c231b tests: Decrease the various sleeps 2025-01-27 22:08:42 +01:00
Sylvestre Ledru
74d80eab0a
Merge pull request #7061 from DaringCuteSeal/cp-stream-2
cp: implement copying from streams
2025-01-13 14:13:13 +01:00
Daniel Hofstetter
e75abb2dbd cp: fix error from large_stack_arrays lint in test 2025-01-10 08:33:28 +01:00
Daringcuteseal
c6d1923701
tests/cp: add test to copy from stdin 2025-01-06 20:21:13 +07:00
Daringcuteseal
b75d0f9446
tests/cp: remove FreeBSD guard in FIFO copy test
Copying FIFOs now work under FreeBSD and other UNIX platforms.
2025-01-06 19:40:12 +07:00
Sylvestre Ledru
934e85f4cd
cp: make --backup and --no-clobber are mutually exclusive (#7082)
* 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>
2025-01-06 09:40:41 +01:00
Mark
49ae68d443
cp: copy attributes after making subdir (#6884) 2025-01-05 22:12:12 +01:00
Sylvestre Ledru
da2a4fedf5 cp: when copying a read only file, make sure that the xattrs can be set properly
on the destination

Should fix tests/misc/xattr.sh
2025-01-04 20:36:43 +01:00
Daniel Hofstetter
c8b0c8b612 cp: remove some sleep() calls in tests 2024-11-26 10:35:13 +01:00
Daniel Hofstetter
e947c713c8
cp: separate tests with empty line 2024-10-31 10:55:22 +01:00
mhead
ff586b47d4 cp: Duplicate source error message specify the type of file. 2024-10-31 11:49:29 +05:30
mhead
4d5bf4205f cp: skip duplicate source check when --backup is given 2024-10-27 14:18:20 +05:30
mhead
74cd797c8a cp: normalize path when checking for duplicate source 2024-10-26 12:09:38 +05:30
Luv-Ray
85b0ef132b
cp: fix symlink-overwrite error-priority (#6586) 2024-10-16 08:55:43 +02:00
David Campbell
353eb53367
Fix clippy::uninlined_format_args . 2024-09-19 17:56:27 -04:00
Andrew Liebenow
b8150f5ba5
cp: show mode if target does not have S_IWUSR (PR #6696) (#6700)
* 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>
2024-09-18 10:23:54 +02:00
sreehari prasad
8a9fb84a8e
mv: gnu test case mv-n compatibility (#6599)
* 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>
2024-09-14 09:11:17 +02:00
LoricAndre
399384062d chore: add non-regression tests for cp arg count 2024-09-10 12:20:47 +02:00
Samuel Tardieu
af86aee6b8 cp: look for specific error messages in tests 2024-09-08 13:27:24 +02:00
Samuel Tardieu
dd9e7ad363 cp: treat an empty file name as a non-existing file 2024-09-08 13:27:24 +02:00
mhead
36237a2568 cp: fix cp throwing error when dest is symlink and options backup and --rem is given 2024-07-26 00:49:34 +02:00
Ben Wiederhake
42b3baf32f clippy: simplify code according to nightly 'needless_borrows_for_generic_args' lint
https://rust-lang.github.io/rust-clippy/master/index.html#/needless_borrows_for_generic_args
2024-07-18 15:59:36 +02:00