Commit graph

12287 commits

Author SHA1 Message Date
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
6ac29cb577
Merge pull request #6023 from uutils/renovate/tempfile-3.x
chore(deps): update rust crate tempfile to 3.10.1
2024-02-27 06:56:03 +01:00
renovate[bot]
06ad75ea30
chore(deps): update rust crate tempfile to 3.10.1 2024-02-27 01:22:08 +00: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
Daniel Hofstetter
a853a5b3ef
Merge pull request #6021 from uutils/renovate/half-2.x
chore(deps): update rust crate half to 2.4
2024-02-26 09:11:19 +01:00
renovate[bot]
c2e7eed27f
chore(deps): update rust crate half to 2.4 2024-02-26 04:34:43 +00: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
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
f25b2102db shuf: document new benchmark category 2024-02-24 21:36:13 +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
989178f438 shuf: extract minimal required interface between data and core loop 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
Sylvestre Ledru
9af65c0397
Merge pull request #5999 from BenWiederhake/dev-tr-squeeze-last-set
tr: Properly handle deleting and squeezing
2024-02-23 08:33:13 +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
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
Terts Diepraam
69ea02d9b0
Merge pull request #5989 from BenWiederhake/dev-shuf-echo-anywhere
shuf: treat -e as a flag, not as a multi-value arg
2024-02-23 00:16:42 +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
Sylvestre Ledru
f7821cd0d2
Merge pull request #5995 from cakebaker/factor_enable_debug_assert
factor: enable a debug_assert! statement
2024-02-22 16:51:54 +01:00
Sylvestre Ledru
c8ce04e310
Merge pull request #5996 from cakebaker/shuf_add_missing_word
shuf: add missing word to BENCHMARKING.md
2024-02-22 16:46:06 +01:00
Daniel Hofstetter
999303e0d4 shuf: add missing word to BENCHMARKING.md 2024-02-22 15:13:54 +01:00
Daniel Hofstetter
4da633b835 factor: enable a debug_assert! statement 2024-02-22 09:33:29 +01:00
Sylvestre Ledru
4dba45d1da
Merge pull request #5988 from cakebaker/fix_imported_redundantly_warnings
Fix "item x imported redundantly" warnings
2024-02-20 08:17:06 +01:00
Daniel Hofstetter
725da985c1 Fix "item x imported redundantly" warnings 2024-02-19 15:39:37 +01:00
Terts Diepraam
177ac7ea28
stat: use chrono instead of time in fsext (#5934)
* stat: use chrono instead of time in fsext

This removes the dependency of `fsext` on `time` and it cleans up the code.

* stat: use chrono instead of time in fsext

This removes the dependency of `fsext` on `time` and it cleans up the code.

* stat: fix two errors from clippy & spell-checker

* stat: move fn to fix clippy error

* stat: print - if birth time unknown

* uucore/fsext: fix "unused import" error on Windows

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-02-19 10:21:26 +01:00