Commit graph

3344 commits

Author SHA1 Message Date
Ben Wiederhake
7b219aee63 cksum: implement trivial --tag flag 2024-03-18 20:59:59 +01:00
Ben Wiederhake
edb1eb0a76 cksum: allow repeated flags and arguments 2024-03-18 20:59:59 +01:00
Daniel Hofstetter
2f4969c0e9
Merge pull request #6090 from sylvestre/csplit2
csplit: adjust the error message to match GNU's
2024-03-18 09:33:54 +01:00
Sylvestre Ledru
696615099c
Merge pull request #6088 from cre4ture/fix/gnu_test_dd_not_rewound_sh
`dd` fix gnu test `not-rewound.sh`
2024-03-17 23:03:22 +01:00
Ulrich Hornung
40577177b2
re-use existing fd for stdout even if its a seek-able file
this is important as the fd holds the file offset we need to use
2024-03-17 20:46:49 +01:00
Sylvestre Ledru
b49fbd9a21 csplit: run the file check before the arguments verifications 2024-03-17 19:09:34 +01:00
Sylvestre Ledru
8551c55ab3 csplit: adjust the error message to match GNU's
Should fix tests/csplit/csplit
2024-03-16 22:21:44 +01:00
Daniel Hofstetter
6d8b21da80 Fix two "item x is imported redundantly" warnings 2024-03-15 14:53:00 +01:00
Sylvestre Ledru
62a3fb8d3f
Merge pull request #5909 from cakebaker/split_fix_error_message_if_file_doesnt_exist
split: fix error message shown if file doesn't exist
2024-03-13 17:41:56 +01:00
Sylvestre Ledru
f89cfe2a5e
Merge pull request #6061 from cre4ture/fix/flaky_timeout_kill_subprocess
Fix/flaky timeout kill subprocess
2024-03-13 11:13:09 +01:00
Daniel Hofstetter
09adf77503 sort: fix incorrectly placed "}" in test 2024-03-13 07:19:42 +01:00
Ulrich Hornung
7e22f99913
remove second sh process to have timeout waiting for the right process 2024-03-12 19:08:51 +01:00
Ulrich Hornung
a2a375d0dd
using other than TERM/KILL signal to see if --preserve-status works 2024-03-12 19:05:51 +01:00
Sylvestre Ledru
1725479c06
hashsum: also escape/unescape files with checks (#5868)
* hashsum: make tag conflicts with --text and --check

* hashsum: change the case in one of the gnu test

* build-gnu.sh: use symlink instead of copy

Plus: it won't cp new md5

* hashsum: also escape/unescape files with checks

Should fix tests/cksum/md5sum-bsd.sh

* improve the variable name

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* Improve test

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* Improve test

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-03-12 14:56:27 +01:00
Daniel Hofstetter
c619dbc99c split: fix error msg shown if file doesn't exist 2024-03-12 14:28:25 +01:00
Sylvestre Ledru
ffb70592ec
Merge pull request #5851 from cre4ture/fix/install_invalid_link_at_destination
Fix install: invalid link at destination
2024-03-12 08:02:18 +01:00
Ulrich Hornung
7cd754eb1f
Fix install: invalid link at destination
also remove some FixMEs for FreeBsd
2024-03-11 23:31:26 +01:00
Sylvestre Ledru
89b326fe1e
cp: improve the support of --attributes-only (#6051)
* cp: improve the support of --attributes-only

* remove useless comments

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-03-11 08:35:27 +01:00
Sylvestre Ledru
80702d5391
Merge pull request #6014 from BenWiederhake/dev-shuf-range-off-by-one
shuf: Fix off-by-one errors in range handling
2024-03-10 22:44:12 +01:00
Sylvestre Ledru
2e8f0e501c
Merge pull request #6039 from BenWiederhake/dev-chcon-repeat-args
chcon: Handle repeated flags and overrides between --no-XXX and --XXX
2024-03-10 22:36:57 +01:00
Yury Zhytkou
156d3f7ee7
cut: allow non utf8 characters for delimiters (#6037) 2024-03-10 22:36:17 +01:00
Ideflop
a227af70bc test/more: test argument --pattern 2024-03-10 22:14:26 +01:00
Daniel Hofstetter
0579233b2d chgrp: fix clippy warning 2024-03-10 13:56:31 +01:00
Daniel Hofstetter
9054a24fb7 pr: fix deprecation warnings & remove comment 2024-03-10 13:55:49 +01:00
Daniel Hofstetter
1eaa87cd62
Merge pull request #6052 from sylvestre/clippy43
Fix clippy warnings
2024-03-10 13:31:08 +01:00
Terts Diepraam
a578fe9e55
Merge pull request #6050 from matrixhead/main
dd : treat arg as bytes if it contains a 'B'
2024-03-10 12:52:29 +01:00
Yash Thakur
d11d595fda
touch: Respect -h when getting metadata (#5951)
* Add tests that stat symlinks

* Check follow first in stat

* Don't run tests on FreeBSD

It would be possible to get them to run on FreeBSD by avoiding
get_symlink_times, but the behavior we're testing is not
platform-specific, so it's fine to not test it on FreeBSD.

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2024-03-10 08:05:59 +01:00
Sylvestre Ledru
8c7940260b
Merge pull request #6047 from cakebaker/bump_chrono
Bump chrono to 0.4.35 & replace usage of deprecated functions
2024-03-10 07:51:50 +01:00
Ben Wiederhake
8be5f7a89d chcon: allow repeated flags and arguments 2024-03-09 22:52:55 +01:00
Ben Wiederhake
dbfd4d80ee chcon: allow overriding between --dereference and --no-dereference 2024-03-09 22:52:55 +01:00
Ben Wiederhake
b233569b9c shuf: fix error message text on negative-sized ranges
Found by @cakebaker:
https://github.com/uutils/coreutils/pull/6011#discussion_r1501838317
2024-03-09 22:51:13 +01:00
Ben Wiederhake
4ee3f68e6a shuf: fix and test off-by-one errors around ranges 2024-03-09 22:51:13 +01:00
Sylvestre Ledru
6c29ed037b
Merge pull request #6042 from BenWiederhake/dev-chown-preserve-root
chown+chgrp+chmod: Fix handling of preserve root flag and error messages
2024-03-09 22:44:59 +01:00
Sylvestre Ledru
dcfb03aad6 Fix clippy warnings 2024-03-09 22:31:33 +01:00
mhead
1819cdee3b dd: treat arg as bytes if it contains 'B' 2024-03-10 01:38:50 +05:30
Ulrich Hornung
db142f9449
use std::command::pre_exec() to set limits on child before exec 2024-03-08 20:30:34 +01:00
Ben Wiederhake
5c2c38c31e chgrp+chown: also trigger preserve-root during dirwalking, fix error message
This is explicitly tested in the GNU tests.
2024-03-07 14:58:02 +01:00
Daniel Hofstetter
aad8f7d8b5 touch: replace use of deprecated chrono functions 2024-03-06 18:16:49 +01:00
Daniel Hofstetter
4d66af2f53
Merge pull request #6034 from BenWiederhake/dev-cat-flags-everything
cat: Handle all flags correctly
2024-03-04 10:57:55 +01:00
Daniel Hofstetter
679b9e2c0a
cat: prefix two test fns with "test_" 2024-03-04 09:41:09 +01:00
Daniel Hofstetter
d651063de3 tests/common/util.rs: add cfg(feature = "env") 2024-03-03 15:02:19 +01:00
Ben Wiederhake
cd70d7dec1 cat: ignore -u flag, just like GNU does 2024-03-01 23:56:30 +01:00
Ben Wiederhake
472b56f0ff cat: fix -b and -n anti-symmetry 2024-03-01 23:56:30 +01:00
Ben Wiederhake
100a48fda9 cat: permit repeating command-line flags 2024-03-01 23:56:30 +01:00
Sylvestre Ledru
9003e3fbe4
Merge pull request #5869 from cre4ture/feature/simulate_terminal_utility
test utilities: easy way to simulate terminal context
2024-03-01 18:13:27 +01:00
Ben Wiederhake
ba1c6b0044 cp: fix flaky test test_cp_arg_interactive_update, document adjacent bug 2024-03-01 11:41:22 +01:00
Dorian Péron
58ee0ce427 tests/printf: Verify the correct error behavior of printf when provided with '%0c' or '%0s' 2024-03-01 00:02:31 +01:00
Dorian Péron
42cde767d2 printf: Change get_char and write_padded to handle bytes instead of chars 2024-02-29 00:59:08 +01:00
Dorian Péron
5d74a6e002 tests/printf: Fix char_as_byte test, add char and string padding tests 2024-02-29 00:43:47 +01:00
Sylvestre Ledru
769c5ca7a5
Merge pull request #6000 from BenWiederhake/dev-pipein-fails-flake
tests: Harden two tests, prevent 4 flaky tests (cat, numfmt, sort, split, tee)
2024-02-28 09:41:00 +01:00
Daniel Hofstetter
aa0d15d1ac
Merge pull request #6011 from BenWiederhake/dev-shuf-repeat-zero-items
shuf: Refuse repeating zero lines
2024-02-27 15:28:06 +01:00
Daniel Hofstetter
ae7d03cb15
Merge pull request #6007 from BenWiederhake/dev-basexx-multi-arg
base32/base64/basenc: implement and test proper flag parsing
2024-02-27 15:03:47 +01:00
Sylvestre Ledru
56e26f72b5
Merge pull request #6022 from cakebaker/uniq_use_concat
uniq: use `concat!` in tests for better readability
2024-02-27 13:09:21 +01:00
Daniel Hofstetter
8b2a2921c5
Merge pull request #6018 from BenWiederhake/dev-basename-multi-arg
basename: Fix handling of repeated flags/arguments
2024-02-27 10:03:14 +01:00
Daniel Hofstetter
c85970485a uniq: use concat! in tests for better readability 2024-02-26 16:37:01 +01:00
Daniel Hofstetter
d8e6f36fcb
Merge pull request #6017 from BenWiederhake/dev-uniq-flake-stdin-write-gnutest
uniq: Fix flaky test gnu_tests
2024-02-26 16:18:26 +01:00
Matei Mantu
095eced4be
chmod: Fix chmod -c --reference reporting when no change is made (#6016)
* Make fperm hold 6 digit octal permission. Set it to 4 digits when displaying

* Add test

* Make every permission 4 octal digits

* Change test name to be more suggestive

* chmod: merge two args in test

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-02-26 11:01:50 +01:00
Ulrich Hornung
d8b3b41850
added configurable terminal size 2024-02-25 21:47:07 +01:00
Ben Wiederhake
f905d9ce41 basename: implement and test repeated flags and arguments
Note in particular that `args_override_self` would *NOT* work here,
since it would in all cases cause `options::NAME` to override itself,
or interfere with `trailing_var_arg`.
2024-02-25 19:45:32 +01:00
Ben Wiederhake
9441806a23 basename: test flag implications, document -z correctly 2024-02-25 19:14:17 +01:00
Ulrich Hornung
a4d5defeef
simulate terminal utility (squash) 2024-02-25 18:15:15 +01:00
Ben Wiederhake
e91d0bd14f uniq: fix flaky test gnu_tests
The testcase tries to write to the stdin pipe while the process under
test is simultaneously exiting with an error code. Naturally, this is a
race, and we should ignore any stdin write errors. However, adding this
feature to the list makes it even more unreadable, and adds no real
value, so let's skip the input data entirely.
2024-02-25 17:59:09 +01:00
Ben Wiederhake
6834b593ee shuf: refuse repeating zero lines
This was a GNU behavior bug:

```console
$ LC_ALL=C shuf -er
shuf: no lines to repeat
[$? = 1]
$ cargo run shuf -er  # old, bad (unexpected success)
$ cargo run shuf -er  # new
shuf: no lines to repeat
[$? = 1]
```
2024-02-25 16:49:03 +01:00
Terts Diepraam
d7a09c042a
Merge pull request #6010 from BenWiederhake/dev-pr-fix-flaky-diff-timestamp
pr: Check the correct timestamp in test_with_pr_core_utils_tests
2024-02-25 11:46:39 +01:00
Sylvestre Ledru
174864566e
Merge pull request #6006 from BenWiederhake/dev-tr-multi-arg
tr: Correctly handle multiple appearances of flag-args
2024-02-25 09:51:40 +01:00
Sylvestre Ledru
8301a8e5be
Merge pull request #5980 from BenWiederhake/dev-shuf-number-speed
shuf: Fix OOM crash for huge number ranges
2024-02-25 09:50:49 +01:00
Yury Zhytkou
17174ab986
uniq: pass remaining GNU tests (#5994) 2024-02-25 09:45:37 +01:00
Ben Wiederhake
5fed98bb01 pr: check the correct timestamp in test_with_pr_core_utils_tests 2024-02-24 23:48:33 +01:00
Ben Wiederhake
445905a045 base32/base64/basenc: permit repeating -d/-i/-w flags 2024-02-24 21:11:18 +01:00
Ben Wiederhake
36e142aa15 basenc: use last given encoding, instead of priority list 2024-02-24 20:44:07 +01:00
Ben Wiederhake
c6f75c98b7 basenc: Test basic functionality
It's good that all encodings already work. Let's make sure they cannot regress!
2024-02-24 20:44:07 +01:00
Ben Wiederhake
44310f426c tr: enable passing -t multiple times 2024-02-24 18:37:45 +01:00
Ben Wiederhake
268af90843 tr: enable passing -s multiple times 2024-02-24 18:37:45 +01:00
Ben Wiederhake
352a8a5bd7 shuf: handle --input-range with huge number ranges
This requires special handling, because we cannot always generate all
possible strings beforehand, e.g. in the case of "-n 2 -i 0-2147483647".
2024-02-24 18:33:46 +01:00
Ben Wiederhake
dc664006fe tr: enable passing -d multiple times 2024-02-23 11:58:22 +01:00
Ben Wiederhake
cad94a69be tr: prevent passing options in the wrong place
Note: This requires using the DEPRECATED item Command::trailing_var_arg
in clap. This is going to be another
[problem with clap](https://github.com/tertsdiepraam/uutils-args/blob/main/docs/design/problems_with_clap.md).
2024-02-23 11:58:22 +01:00
Ben Wiederhake
d9b6675bbf tr: enable passing -c multiple times 2024-02-23 11:58:18 +01:00
Daniel Hofstetter
5a2e0c700e
Merge pull request #5990 from BenWiederhake/dev-shuf-head-null
shuf: Do not read input when -n0 is given
2024-02-23 09:01:14 +01:00
Sylvestre Ledru
208b2dbb51
Merge pull request #5997 from BenWiederhake/dev-unignore
Un-Ignore two tests that fail for nonsense reasons
2024-02-23 08:34:07 +01:00
Sylvestre Ledru
1691127c79
Merge pull request #6001 from BenWiederhake/dev-dd-small-times
dd: fix flaky test_final_stats_unspec
2024-02-23 08:33:35 +01:00
Ben Wiederhake
ede944e1f8 dd: fix flaky test_final_stats_unspec
If the first four decimal digits are zero, GNU dd elides them altogether.
Here's an execution on my PC:

```console
$ for i in $(seq 20000); do LC_ALL=C gnu_dd if=/dev/null of=/dev/null \
    2>&1; done | grep copied | grep -E ' [0-9]e'
0 bytes copied, 1e-05 s, 0 B/s
0 bytes copied, 9e-06 s, 0.0 kB/s
```

Our implementation conforms to this, resulting in the following CI flake:

```
---- test_dd::test_final_stats_unspec stdout ----
run: D:\a\coreutils\coreutils\target\x86_64-pc-windows-gnu\debug\coreutils.exe dd
thread 'test_dd::test_final_stats_unspec' panicked at 'Stderr does not match regex:
0+0 records in
0+0 records out
0 bytes copied, 8e-05 s, 0.0 B/s
', tests\by-util\test_dd.rs:280:10
stack backtrace:
   0: rust_begin_unwind
             at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library\std\src/panicking.rs:578:5
```

Of course, this is just an overly strict regex in the test. This was a
one-in-tenthousand flaky test.
2024-02-23 06:24:11 +01:00
Ben Wiederhake
617f3a8b6f tr: when deleting and squeezing, never complement set2 2024-02-23 06:08:37 +01:00
Ben Wiederhake
b3d8344d1d split: don't flake even on exotic pipe buffer sizes 2024-02-23 05:42:29 +01:00
Ben Wiederhake
44c59a6d28 numfmt: don't flake even on exotic pipe buffer sizes 2024-02-23 05:42:29 +01:00
Ben Wiederhake
bcd2d888a1 cat: don't flake even on exotic pipe buffer sizes
See also 9995c637aa.

There is a race condition between the writing thread and the command.
It is easily possible that on the developer's machine, the writing
thread is always faster, filling the kernel's buffer of the stdin pipe,
thus succeeding the write. It is also easily possible that on the busy
CI machines, the child command runs first for whatever reason, and exits
early, thus killing the pipe, which causes the later write to fail. This
results in a flaky test. Let's prevent flaky tests.
2024-02-23 05:42:17 +01:00
Ben Wiederhake
9fa808fb5e sort: add skipped test for combined flags
Now that clap#2624 has been resolved, we can and should test both variants.
2024-02-23 05:42:01 +01:00
Ben Wiederhake
868600cac9 tee: fail test if string setup fails 2024-02-23 05:42:01 +01:00
Ben Wiederhake
48c4b57c97 tr: require second string argument when deleting and squeezing 2024-02-23 03:23:07 +01:00
Ben Wiederhake
27030e9f53 touch: re-enable test, fix typo in expected error messge 2024-02-23 00:21:19 +01:00
Ben Wiederhake
e50eb19056 head: fix 'test_spams_newline' to check *against* newline spam
The comment was introduced in commit 8320b1ec5f,
the test was introduced in commit c1f518e586
claiming to be about "failing GNU head tests".

However, a simple check reveals no such difference:

```console
$ echo -n a | hd
00000000  61                                                |a|
00000001
$ echo -n a | head | hd  # GNU head
00000000  61                                                |a|
00000001
$ echo -n a | cargo run -- head | hd
00000000  61                                                |a|
00000001
$ echo -n a | busybox head | hd
00000000  61                                                |a|
00000001
$
```

Looking at the GNU tests directly, it seems that there is a similar, but different test.
2024-02-23 00:21:19 +01:00
Ben Wiederhake
a29f68b720 shuf: Do not read input when -n0 is given
This is explicitly tested by some suites, including the GNU test suite.
2024-02-22 23:50:03 +01:00
Ben Wiederhake
a59924ece5 shuf: treat -e as a flag, not as a multi-value arg 2024-02-22 23:22:35 +01:00
Daniel Hofstetter
725da985c1 Fix "item x imported redundantly" warnings 2024-02-19 15:39:37 +01:00
Ulrich Hornung
d6ca9e3800
disable failing test_od::test_f16() for android CI. 2024-02-17 18:24:09 +01:00
Ben Wiederhake
b091911aae shuf: refuse multiple input ranges and multiple output files 2024-02-16 21:14:56 +01:00
Ben Wiederhake
69f23c2521 shuf: obey all headcount args, not just the last 2024-02-16 21:08:16 +01:00
Ben Wiederhake
07e8f4c7a5 shuf: include all echo args, not just the last 2024-02-16 20:49:59 +01:00
Daniel Hofstetter
420dfe8a9b
Merge pull request #5958 from tertsdiepraam/csplit-printf
`csplit`: use `printf` functionality from `uucore`
2024-02-16 14:39:03 +01:00
Terts Diepraam
fc82360f58 csplit: fix up tests and error message for filenames 2024-02-16 11:51:04 +01:00
Daniel Hofstetter
bfe6f0f004
Merge pull request #5979 from BenWiederhake/dev-shuf-null-input
shuf: Treat empty file as zero elements instead of one emptystring
2024-02-16 09:19:44 +01:00
Ben Wiederhake
e54c9bebe2 shuf: Treat empty file as zero elements instead of one emptystring 2024-02-16 00:06:24 +01:00
biplab5464
04c821ca78 pr: use chrono instead of time in tests #5972 2024-02-14 23:08:34 +05:30
Daniel Hofstetter
6adaf31d49
Merge pull request #5962 from wolimst/cut/fix/multiple-mode-args
cut: show error for multiple mode args (`-b`, `-c`, `-f`)
2024-02-14 14:23:47 +01:00
BaherSalama
5603305e75
fix tr with any flag with more than 2 operands (#5952)
* fix tr

* add tests

* fix clippy

* fix clippy2

* do suggestions

* do suggestions

* remove mut

* tr: move var to block & remove its type

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-02-13 15:30:15 +01:00
Terts Diepraam
3a21d27c1e uucore/format: ignore the 0 flag if a precision is specified 2024-02-10 12:22:11 +01:00
Terts Diepraam
5fbbfc75de csplit: add test for precision syntax 2024-02-10 11:59:41 +01:00
Terts Diepraam
3126e5f8a1 printf: fix padding and prefixes for unsigned ints 2024-02-09 13:28:18 +01:00
Terts Diepraam
4dae902429 printf: pad octal numbers with zeros on the left 2024-02-09 13:28:18 +01:00
wolimst
cb0ce0e1cb cut: show error for multiple mode args (-b, -c, -f) 2024-02-09 15:56:15 +09:00
Daniel Hofstetter
04ebd863a6 clippy: fix warnings introduced by Rust 1.76 2024-02-08 16:56:01 +01:00
Daniel Hofstetter
9995c637aa tr: fix intermittent test caused by pipe_in() 2024-02-08 07:25:09 +01:00
BaherSalama
5c2ae5be4f
fix tr with delete flag if more than 1 operand given (#5945)
* fix tr

* fix

* adding a test

* tr: rename test function

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-02-06 16:42:08 +01:00
Daniel Hofstetter
d2a75457f6 Fix errors reported by new version of cspell 2024-02-05 09:12:52 +01:00
Ludmuterol
96d96e7de3
more handle errors with multiple files (#4997)
* more handle errors with multiple files

* tests/more test refactor and new case

* tests/more new cases

* more: use show! and change exitstatus and adjust tests to new exitvalue

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2024-02-04 16:32:14 +01:00
Biplab Mochan Gartia
fd4e1cfb28
stat: should fail without arguments #5928 (#5935)
* stat: should fail without arguments #5928

* style and lint issue  stat: should fail without arguments #5928

* style and lint issue  stat: should fail without arguments #5928

* style and lint 2 issue  stat: should fail without arguments #5928

---------

Co-authored-by: biplab5464 <biplab5464@outlook.com>
2024-02-02 17:00:35 +01:00
Sylvestre Ledru
8691ec9a80
Merge pull request #5916 from cakebaker/du_non_existing
du: adapt error message to match GNU's
2024-01-30 17:13:37 +01:00
Sudhakar Verma
bd336ebbf1 dd: fail on missing number in count 2024-01-30 20:21:25 +05:30
Daniel Hofstetter
d1e1e9ce0f du: adapt error msg to match GNU's 2024-01-30 10:08:50 +01:00
Terts Diepraam
1b324da436 echo: do not infer long args 2024-01-29 17:40:22 +01:00
Daniel Hofstetter
74bcfff3e8 rm: add test for "rm .\dir\ -rf" on Windows
https://github.com/uutils/coreutils/issues/3200
2024-01-28 16:36:55 +01:00
kralo
5dccfc2441 cp: test_cp_preserve_xattr_fails_on_android disabled as its now failing to fail 2024-01-28 08:56:08 +01:00
kralo
3eba95728c factor: remove clippy exceptions by reformatting "unreadable literals"
Closes: #5884
2024-01-27 17:23:44 +01:00
Sylvestre Ledru
ae5f2bc0d0
Merge pull request #5875 from cakebaker/expand_make_tab_explicit_in_test
expand: make tab explicit in test
2024-01-26 14:36:48 +01:00
Daniel Hofstetter
c8cd355708 cut: set exit code to 1 if dir is specified 2024-01-26 10:18:44 +01:00
Daniel Hofstetter
5bd00eb791 cut: split test function into two functions 2024-01-26 10:09:28 +01:00
Daniel Lungu
61c730d1b3
expand: Continue work when one of given files doesn't exist (#5873)
* expand: continues work when one of given files doesn't exist

* fixed test for nonexisting file
2024-01-25 09:10:59 +01:00
Biplab Mochan Gartia
150b287fe8
unexpand: allow multiple files & show error message if a directory is specified
* unexpand: should allow multiple files #5852 and unexpand: show error message if a directory is specified #5845

* test file added for #5845 #5852

* test case test_multiple_files improve

* cakebaker suggestion for a better code #5845 #5852

---------

Co-authored-by: biplab5464 <biplab5464@outlook.com>
2024-01-24 16:01:26 +01:00
Daniel Hofstetter
8c4c6a53ec expand: make tab explicit in test 2024-01-24 09:46:27 +01:00
Daniel Hofstetter
f124910226
Merge pull request #5865 from sylvestre/md5sum-escape
hashsum: when the filename contains some special chars, escape them
2024-01-21 12:55:08 +01:00
Sylvestre Ledru
5e29c60b26 hashsum: when the filename contains some special chars, escape them
Should fix tests/cksum/md5sum-newline.pl
2024-01-20 19:27:45 +01:00
Laurent Cheylus
4589f637ee tests: disable tests for tools unsupported on OpenBSD
pinky, uptime and who are not supported on OpenBSD (no support of utmpx feature) => disable tests
for these tools on OpenBSD with conditional compilation

Signed-off-by: Laurent Cheylus <foxy@free.fr>
2024-01-19 17:37:45 +01:00
SaHHiiLL
746a7b14d0
tsort: returns error when input is dir - same as GNU tsort (#5860)
* fix: return error when input is dir

* test: when tsort is given a dir

* fix: do not need to mention tsort in error message

* test: using concrete directory name

* tsort: fix formatting in test

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-01-19 15:39:00 +01:00
Terts Diepraam
3bd9f0ec65
Merge pull request #5811 from spineki/fix-printf-hex-alternate-zero
Printf: Fix printf hex alternate zero
2024-01-17 10:28:30 +01:00
Ulrich Hornung
dc533a915a
install: fix strip program stdout and destination hyphen handling #5718 (#5848)
* Fix missing dependency to "process" to make it compile.

* fix issue of not forwarding stdout from strip program

* fix issue of applying "./" redundantly

* cargo fmt
2024-01-17 10:07:34 +01:00
Sylvestre Ledru
69c8753f80 cp test: use compare_xattrs from tests/utils 2024-01-16 13:12:02 +01:00
Sylvestre Ledru
2ec4e9f784 mv: preserve the xattr
Should make tests/mv/acl pass
2024-01-16 13:12:02 +01:00
Sylvestre Ledru
238fb776ad test: add a function to compare the xattr between two files.
used by cp & mv (at least)
2024-01-16 13:12:02 +01:00
Daniel Hofstetter
112eb21eb3
Merge pull request #5791 from sylvestre/handle-error
Handle better some errors
2024-01-15 15:19:10 +01:00
Sylvestre Ledru
fff83995fb
cp: --preserve should keep xattr (#5834)
* cp: --preserve should keep xattr

Should help with tests/cp/acl.sh

* Update tests/by-util/test_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>

* 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>
2024-01-15 10:59:04 +01:00
Sylvestre Ledru
b116a97fdc
add missing \n 2024-01-15 10:43:20 +01:00
Sylvestre Ledru
4557821adf
Merge branch 'main' into fix-printf-hex-alternate-zero 2024-01-15 10:41:09 +01:00
Biplab Mochan Gartia
076b905513
cksum: stops when one of given files doesn't exist #5809 (#5820)
* cksum: stops when one of given files doesn't exist #5809

* removed printld  cksum: stops when one of given files doesn't exist #5809

* formatting the code cksum: stops when one of given files doesn't exist #5809

* formatting the code cksum: stops when one of given files doesn't exist #5809

* set exist status cksum: stops when one of given files doesn't exist #5809

* code quality formatting issue cksum: stops when one of given files doesn't exist #5809

* tertsdiepraam idea cksum: stops when one of given files doesn't exist #5809

* one new test case and deleted duplicate show cksum: stops when one of given files doesn't exist #5809

* formatting the test cases cksum: stops when one of given files doesn't exist #5809

* Revert "formatting the test cases cksum: stops when one of given files doesn't exist #5809"

This reverts commit 8c382f1e8f.

* reverting the changes and committing again due to a mistake cksum: stops when one of given files doesn't exist #5809

---------

Co-authored-by: biplab5464 <biplab5464@outlook.com>
2024-01-15 09:37:56 +01:00
Sylvestre Ledru
36039a819d
Merge pull request #5739 from cakebaker/cp_backup_with_symlink_to_source
cp: backup dest symlink linking to source
2024-01-14 23:30:06 +01:00
Sylvestre Ledru
e3beda08ac
Merge pull request #5762 from cakebaker/cp_link_same_file
cp: show no "same file" error for `--link a a`
2024-01-14 23:29:33 +01:00
Sylvestre Ledru
ef03a4625f
Merge pull request #5806 from cakebaker/nl_is_a_directory
nl: don't exit if input is directory
2024-01-14 23:29:05 +01:00
Sylvestre Ledru
ae279c9961
Merge pull request #5818 from cakebaker/pathchk_no_args
pathchk: simplify and rename test
2024-01-14 23:28:42 +01:00
Sylvestre Ledru
3d356d47b3 expand: avoid an infinite loop 2024-01-14 23:27:00 +01:00
Sylvestre Ledru
8d24036f5c basenc: handle '--base32 .' arg 2024-01-14 23:27:00 +01:00
Sylvestre Ledru
4f33a375cd factor: handle the '< .' arg 2024-01-14 23:26:57 +01:00
Sylvestre Ledru
22a7173305
Merge pull request #5838 from cakebaker/head_fix_clippy_warnings_in_tests
head: fix clippy warnings in tests
2024-01-14 16:23:05 +01:00
Sylvestre Ledru
e01d5f75f7
ls: if acl are used, show the + in the perms (#5816)
* ls: if acl are used, show the + in the perms

Tested by tests/mkdir/p-acl.sh

* CICD.yml: fix small formatting issue

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-01-14 15:57:22 +01:00
Daniel Hofstetter
aeee56b3c3 head: fix clippy warnings in tests 2024-01-14 15:23:24 +01:00
Daniel Hofstetter
ac27b6c4b0
Merge pull request #5833 from sylvestre/cut-multiple
cut: allow the same option to be passed multiple times
2024-01-13 16:58:04 +01:00
Sylvestre Ledru
bc51b8d216 cut: allow the same option to be passed multiple times 2024-01-13 15:09:16 +01:00
Atomei Alexandru
563df4b79d
Made cksum return an error if used on a directory. (#5822)
* Made cksum to return an error if it is used on a directory regardless of the algorithm

* Added one more test for cksum on folders and deleted an old one that expected it to succeed instead of fail

* Made cksum work on more than one item if it fails and added a test for this case
2024-01-13 14:43:36 +01:00
Sudhakar Verma
2aa8a3502f printf : no infinite loop 2024-01-12 16:08:47 +05:30
Sylvestre Ledru
edb77b8d59
Merge pull request #5827 from samueltardieu/issue-5826
printf: %c prints the first byte of its argument
2024-01-12 00:25:32 +01:00
Daniel Hofstetter
5b860cb428
Merge pull request #5828 from samueltardieu/printf-double-quote
printf: output of double-quote should not be escaped
2024-01-11 08:52:51 +01:00
Samuel Tardieu
47e908bc6c printf: output of double-quote should not be escaped
This is obtained by escaping the sequence `\"` as `"`.
2024-01-10 19:17:42 +01:00
Sylvestre Ledru
19a9380089
Merge pull request #5803 from D9nni/cksum
cksum: Add --raw argument
2024-01-10 18:36:08 +01:00
Samuel Tardieu
7d32e49fb9 printf: %c prints the first byte of its argument 2024-01-10 18:19:56 +01:00
Marras Antoine
3b884966ac printf: added failing tests on alternative hex form 2024-01-10 16:55:03 +01:00
Samuel Tardieu
a85a792c88 format: use the new number parser and fix the error messages
The error messages are more compliant with GNU coreutils.
Also, floating hexadecimal numbers are now supported in
`printf`.
2024-01-10 14:34:43 +01:00
D9nni
c7b15ddce9 cksum: fixed cksum --raw --algorithm 2024-01-10 15:04:19 +02:00
D9nni
96271ffa3c cksum: added tests for --raw with each algorithm, not working for crc, sysv, bsd 2024-01-09 23:12:40 +02:00
Daniel Hofstetter
f400a07dc6 pathchk: remove useless comments 2024-01-09 15:19:22 +01:00
Daniel Hofstetter
49154669a6 pathchk: simplify and rename test 2024-01-09 15:17:15 +01:00
Samuel Tardieu
5dfeca9ff2 format: %c prints the first character of a string 2024-01-09 00:13:54 +01:00
Sylvestre Ledru
294a0abb9c
Merge pull request #5812 from cakebaker/ln_fix_unused_import_on_android
ln: fix "unused import" warning on Android
2024-01-08 18:05:10 +01:00
Daniel Hofstetter
e29afdc0df head: disable some tests on Android 2024-01-08 17:29:34 +01:00
Daniel Hofstetter
62dffc3250 ln: fix "unused import" warning on Android 2024-01-08 17:17:43 +01:00
D9nni
28b5224725 cksum: fixed test for --raw on single file 2024-01-08 15:50:25 +02:00
Daniel Hofstetter
1c6bf6991c nl: don't exit if input is directory 2024-01-08 11:01:07 +01:00
Sylvestre Ledru
d72343bc64
Merge branch 'main' into cksum 2024-01-08 09:02:11 +01:00
D9nni
f03ef79bc8 cksum: added tests for --raw and fixed fmt whitespace error 2024-01-08 08:51:06 +02:00
Atomei Alexandru Constantin
0bfd4bbdf7 Added test to validate that it now generates the error for an arbitrary directory 2024-01-08 00:08:24 +02:00
Sylvestre Ledru
b309d64e78
Merge branch 'main' into issue-5766 2024-01-06 22:55:54 +01:00
Kostiantyn Hryshchuk
c867d6bfb1
shred: implemented "--remove" arg (#5790) 2024-01-06 22:50:21 +01:00
Sylvestre Ledru
247f2e55bd
seq: adjust some error messages. GNU's are better (#5798)
* seq: adjust some error messages. GNU's are better
tested by tests/seq/seq.pl

* uucore: remove todo

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-01-06 16:54:29 +01:00
Daniel Hofstetter
e13f0d80ee
Merge pull request #5778 from RenjiSann/main
ls: Support QUOTING_STYLE environment variable
2024-01-05 15:55:23 +01:00
Samuel Tardieu
32f0256d7d uucore/num_format: properly display 10ᵖ where p is the precision
`seq --format %.2g 10 10` would display `1` because the precision would
not allow room for the decimal point, and the `0` in `10` would be
trimmed as an insignificant trailing `0`.

This has been fixed by only trimming trailing `0` in the presence of a
decimal point.
2024-01-05 15:40:20 +01:00
Dorian Péron
4372908e84 fix: cargo fmt + fix spelling mistake 2024-01-05 13:55:47 +01:00
Sylvestre Ledru
aabf5fa577 cp: manages target with trailing '/' 2024-01-05 12:56:27 +01:00
Sylvestre Ledru
4c698d58e0 mv: support the case mkdir a && mv a e/ 2024-01-05 12:56:24 +01:00
Dorian Péron
c58575edaa tests/ls: Add tests to ensure env var is used as a last resort 2024-01-05 02:10:33 +01:00
cre4ture
9b3cc5437c
head: head_backwards for non-seekable files like /proc/* or fifos (named pipes) (#5732)
* implement head_backwards for non-seekable files like /proc/* or pipes

Signed-off-by: Ulrich Hornung <hornunguli@gmx.de>
2024-01-05 00:25:59 +01:00
Daniel Hofstetter
e4fbc31714 du: ignore duplicate names with --files0-from 2024-01-03 09:39:16 +01:00
Daniel Hofstetter
239e5426e6 du: show error for nul names with --files0-from 2024-01-02 16:06:41 +01:00
Sylvestre Ledru
2c73e978ba
Merge pull request #5769 from samueltardieu/is-ok-and
test: use clearer expression for CI testing
2024-01-01 22:45:37 +01:00
Samuel Tardieu
05d85618e3 test: use clearer expression for CI testing
`bool::is_ok_and()` is available in Rust 1.70.0 and above, which is compatible
with the current MSRV.
2024-01-01 21:04:13 +01:00
Daniel Hofstetter
7ddeba4b98 cp: show no "same file" error for --link a a 2024-01-01 14:30:27 +01:00
Daniel Hofstetter
5673f32c63 cp: show error if source & dest are same file 2023-12-31 16:01:34 +01:00
Daniel Hofstetter
2c42623b6e cp: backup dest symlink linking to source 2023-12-31 14:09:08 +01:00
Sylvestre Ledru
193bcf86b7 cp: Disable a test failing on freebsd 2023-12-30 17:00:44 +01:00
Vardhan Patil
1fc6a760f3 tests/cksum: fix formatting 2023-12-30 20:31:52 +05:30
Vardhan Patil
e1863ac64e tests/cksum: test when the --length argument is 0 or >512 2023-12-30 20:14:30 +05:30
Vardhan Patil
09ef150085 tests/cksum: add tests for the length argument 2023-12-30 16:01:22 +05:30
Daniel Hofstetter
7025619325 cp: adapt warning if source is used more than once 2023-12-29 10:24:08 +01:00
Daniel Hofstetter
9bb725cefc clippy: fix warnings introduced by Rust 1.75 2023-12-28 18:17:06 +01:00
Sylvestre Ledru
d82ee771aa install: Add a test to cover recent changes 2023-12-28 16:34:09 +01:00
Sylvestre Ledru
764ea34c37 dd/chroot: improve the skip message (not root) 2023-12-28 00:44:19 +01:00
Daniel Hofstetter
0701f535ac cp: fix backup of destination symlink 2023-12-27 15:39:54 +01:00
Matei Mantu
bf26eda786
install: remove / from end of path if it exists so as not to mess with .exists() (#5730)
* remove / from end of path if it exists so as not to mess with .exists()

* install: fix / removal from path

* Fix clippy warnings

* Add test for install target ends with /
2023-12-27 13:37:17 +01:00
Sylvestre Ledru
e26f4c7f36
Merge pull request #5727 from cakebaker/du_simplify_file_creation_in_tests
du: simplify file creation in tests
2023-12-26 16:12:52 +01:00
Sylvestre Ledru
167acb5147
Merge pull request #5484 from cakebaker/cp_l_with_dest_hardlink_to_source
cp --link: don't fail if destination is hardlink to source
2023-12-26 16:12:15 +01:00
Daniel Hofstetter
2d260ded58 du: use concat! to improve readability in tests 2023-12-26 15:19:45 +01:00
Daniel Hofstetter
37c83ec480 du: simplify file creation in tests 2023-12-26 15:15:02 +01:00
Sylvestre Ledru
30eb77ac79
du: implement files0-from (#5721)
* du: implement files0-from

Should make tests/du/files0-from-dir pass

* du: prepare tests/du/files0-from.pl

* fix the build on Windows

* add testfile to the ignore list

* remove useless comment

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* mkdir is enough

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* address review comments

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-12-26 14:40:31 +01:00
Sylvestre Ledru
6d2486c096
Merge pull request #5503 from cakebaker/du_unused_du_basics
du: call unused _du_basics() in test_du_basics()
2023-12-25 22:38:27 +01:00
Sylvestre Ledru
0fb4d8843c
Merge pull request #5455 from n1000/freebsd_fixes_push_3
tests/test: Ensure the test fixture files have the expected gid
2023-12-25 22:03:15 +01:00
Sylvestre Ledru
db9f4cc315
Merge pull request #5483 from cakebaker/mv_fix_5481
mv: fix subdir detection
2023-12-25 22:02:23 +01:00
Sylvestre Ledru
628819701d
Merge pull request #5530 from cakebaker/du_test_posixly_correct
du: test behavior with POSIXLY_CORRECT set
2023-12-25 22:01:25 +01:00
Daniel Hofstetter
f10c6f1d56
Merge pull request #5699 from sylvestre/mv-cp-seen
cp/mv/ln: add support for the "will not overwrite just-created"
2023-12-25 14:58:50 +01:00
Daniel Hofstetter
030fd3d4d2 du: test behavior with POSIXLY_CORRECT set 2023-12-25 13:17:17 +01:00
Daniel Hofstetter
03f1b8aa3a mv: fix subdir detection 2023-12-25 13:12:18 +01:00
Nathan Houghton
1915e3c438 tests/test: Ensure the test fixture files have the expected gid
On some platforms (mostly the BSDs) the test fixture files copied to the
/tmp directory will have a different gid than the current egid (due to
the sticky bit set on the /tmp directory). Fix this before running the
"test" command.
2023-12-25 13:10:22 +01:00
Daniel Hofstetter
4946478409 cp: -l don't fail if dest is hardlink to source 2023-12-25 13:03:11 +01:00
Sylvestre Ledru
356023b055
Merge pull request #5431 from cakebaker/cp_remove_destination_shouldnt_fail_hardlink
cp --remove-destination: don't fail if destination is hardlink to source
2023-12-25 13:02:50 +01:00
Daniel Hofstetter
863c022352
Merge pull request #5723 from sylvestre/tee-warning
tee test: fix a warning on not(linux)
2023-12-25 11:47:13 +01:00
Sylvestre Ledru
6ce9d84232
Merge pull request #5532 from cakebaker/df_fix_5531
df: fix rounding issue in test
2023-12-25 11:23:48 +01:00
Sylvestre Ledru
60d71e3f2a ln: disable a test on android 2023-12-25 11:22:04 +01:00
Sylvestre Ledru
f86e314f46 Fix some obvious comment
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-12-25 11:17:04 +01:00
Sylvestre Ledru
840a5bf083
Merge pull request #5700 from cakebaker/ls_block_size_with_k
ls: set correct block size when -k is provided
2023-12-25 11:14:09 +01:00
Sylvestre Ledru
853f73b7c9 tee test: fix a warning on not(linux)
warning: unused import: `std::fmt::Write`
2023-12-25 11:06:24 +01:00
Daniel Hofstetter
270ac90cc1 ls: set correct block size when -k is provided 2023-12-24 16:35:49 +01:00
Sylvestre Ledru
0220353c4c
test_install.rs: Remove a debug artifact 2023-12-24 15:26:38 +01:00
Sylvestre Ledru
15573579cc Fix the windows tests 2023-12-24 15:18:31 +01:00
Sylvestre Ledru
6b8f71116d
Merge pull request #5717 from cakebaker/wc_android
wc: disable part of test on Android
2023-12-24 14:52:08 +01:00
Daniel Hofstetter
4d05f208e0
Merge pull request #5701 from sylvestre/debug
cp: debug with --update=none should show 'skipped'
2023-12-24 14:25:57 +01:00
Daniel Hofstetter
df492d34cb wc: disable part of test on Android 2023-12-24 13:20:57 +01:00
Sylvestre Ledru
8685e05f4e cp: debug with --update=none should show 'skipped' 2023-12-23 17:58:05 +01:00
Daniel Hofstetter
be822009f0
Merge pull request #5686 from sylvestre/install-basic
install: with -t, check if we aren't passed a file
2023-12-23 15:33:45 +01:00
Sylvestre Ledru
2832694056
install: support when a hyphen is passed (#5697)
* install: support when a hyphen is passed

Should fix: tests/install/strip-program.sh

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-12-23 15:29:32 +01:00
Sylvestre Ledru
ceecac110c ln: manages the 'seen' file list before linking
Should help with tests/mv/childproof.sh
2023-12-23 13:53:26 +01:00
Sylvestre Ledru
c94773f522 mv: make sure it continues when hiting an error 2023-12-23 13:27:00 +01:00
Sylvestre Ledru
3af8ad0fe6 mv: manages the 'seen' file list before moving
Should help with tests/mv/childproof.sh
2023-12-23 13:07:39 +01:00
Sylvestre Ledru
06c98fbdd3 cp: don't fail when --backup=numbered is passed 2023-12-23 12:48:38 +01:00
Sylvestre Ledru
837640bc02 cp: manages the 'seen' file list before copying
Should help with tests/mv/childproof.sh
2023-12-23 12:11:35 +01:00
Sylvestre Ledru
6b1f51385f
Merge pull request #5693 from cakebaker/ls_second_blocksize
ls: introduce 2nd blocksize & fix todos in tests
2023-12-23 09:57:08 +01:00
Sylvestre Ledru
9ca7c3e107 install: with -t, check if we aren't passed a file
Should pass tests/install/basic-1
2023-12-22 18:16:23 +01:00
Daniel Hofstetter
1c6317af76 mv: allow dest with slash when using --update 2023-12-22 17:03:59 +01:00
Daniel Hofstetter
a8a5931cae ls: introduce 2nd blocksize & fix todos in tests 2023-12-22 11:42:01 +01:00
Sylvestre Ledru
e071fd3042
Merge pull request #5684 from allaboutevemirolive/v10_expand
expand: fix duplicate flags
2023-12-21 11:03:09 +01:00
Daniel Hofstetter
0164934afe df: fix rounding issue in test
Set block size to 1 so the returned values are the same values as
used for the calculation of the percentage values
2023-12-21 10:46:11 +01:00
Terts Diepraam
4b2577fc78 test/sort: run cargo fmt 2023-12-21 10:19:52 +01:00
allaboutevemirolive
f874788b2c Use better testcase 2023-12-21 10:48:58 +02:00
allaboutevemirolive
3e6187269e fix duplicate flags 2023-12-20 23:30:46 +02:00
Justin !
a6ba81db20
sort: allow -f to be pass multiple time
Fix #5667
2023-12-20 12:42:57 -05:00
Daniel Hofstetter
d8709d2839 ls: recognize BLOCKSIZE env var 2023-12-19 15:00:06 +01:00
Sylvestre Ledru
9920f13a34
Merge pull request #5640 from tertsdiepraam/tr-no-output
`tr`: operate on bytes instead of chars
2023-12-19 11:42:44 +01:00