1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-05 07:27:46 +00:00
Commit graph

15884 commits

Author SHA1 Message Date
Solomon Victorino
899c118f3f tac: move to thiserror 2025-03-30 21:15:21 +02:00
Solomon Victorino
9db51ec828 split: move to thiserror 2025-03-30 21:15:21 +02:00
Solomon Victorino
4aba193c9c expand: move to thiserror 2025-03-30 21:15:21 +02:00
Solomon Victorino
4cb23dd840 ptx: move to thiserror 2025-03-30 21:15:21 +02:00
ValentinBoudevin
aea23408fd
env: Move to "thiserror" + added errors test case (#7584)
Solved Issue #7535 : Removed parse_errors to follow other commands standard with thiserror
2025-03-30 11:21:57 +02:00
Nicolas Boichat
ae743a976d test_stat: Disable test_stdin_pipe_fifo1/2 on Mac OS X
It's not totally clear why they sometimes work, sometimes fail,
but it does appear that running `stat` on `/dev/stdin` is perhaps
not the most reliable approach.

A likely more solid approach is described in #7583.
2025-03-29 17:11:41 +01:00
Sylvestre Ledru
903fa6ae88
Merge pull request #7514 from drinkcat/format-bigdecimal-tests
uucore: format: num_format: add `fmt` function tests, and workaround 0e10 printing.
2025-03-29 15:43:14 +01:00
Daniel Hofstetter
ba76b2b791
Merge pull request #7607 from sylvestre/uutest-doc
uutests: add a doc
2025-03-29 13:31:13 +01:00
Sylvestre Ledru
8be432e6ef uutests: fix the doc 2025-03-29 09:28:54 +01:00
Sylvestre Ledru
f5241e9d7a
Merge pull request #7605 from karlmcdowall/sum_error_handling
sum: Rework some error handling
2025-03-29 09:16:47 +01:00
Sylvestre Ledru
bb8c043a76 uutests: add a doc 2025-03-29 09:05:50 +01:00
Daniel Hofstetter
6cbb532a70
Merge pull request #7604 from sylvestre/gh
github/action: on fork, run the CI for all the branches (currently: only main)
2025-03-29 08:32:13 +01:00
Karl McDowall
912dc47bef sum: Rework some error handling
Update sum to properly propagate errors from file-reads,
including implementing a retry on ErrorKind::Interrupted.
Also switch to using writeln! rather than println! to prevent
crashes if stdout is directed to /dev/full
2025-03-28 19:22:31 -06:00
Dorian Péron
61b7f4b54b
Merge pull request #7598 from sylvestre/uutests2
Move our tests infra into a dedicated crate
2025-03-28 22:32:49 +01:00
Sylvestre Ledru
a0179ea239 uutests: adjust the tests to use them 2025-03-28 21:40:31 +01:00
Sylvestre Ledru
ccfcda531e uutests: improve the docs 2025-03-28 21:40:31 +01:00
Sylvestre Ledru
50fe623447 Create the uutest crate + adjust the code
+ move some of the tests into the program test
2025-03-28 21:40:31 +01:00
Daniel Hofstetter
99af1b84de
Merge pull request #7602 from uutils/renovate/reactivecircus-android-emulator-runner-2.x
chore(deps): update reactivecircus/android-emulator-runner action to v2.34.0
2025-03-28 17:12:41 +01:00
Sylvestre Ledru
b530fdcc88 github/action: on fork, run the CI for all the branches (currently: only main) 2025-03-28 17:06:20 +01:00
renovate[bot]
c05bc168e1
chore(deps): update reactivecircus/android-emulator-runner action to v2.34.0 2025-03-28 15:15:19 +00:00
Daniel Hofstetter
e4c4200358
Merge pull request #7599 from uutils/renovate/os_display-0.x-lockfile
fix(deps): update rust crate os_display to v0.1.4
2025-03-28 14:10:04 +01:00
renovate[bot]
b5ba4a61e3
fix(deps): update rust crate os_display to v0.1.4 2025-03-28 12:32:58 +00:00
cerdelen
8c8beb96e4
echo: fixed double hyphen as argument (#7581)
* Fixes #7558 Added check to only insert addition double hyphen if at start of arguments to correctly prepend addition hyphens for clap as well as additional test case

* additional comment

* fixes issue where flags precedes "--" as arguments
2025-03-28 13:31:48 +01:00
Sylvestre Ledru
1c75854d2f
Merge pull request #7576 from drinkcat/ci-macos
Test workspace CI on macos
2025-03-28 11:54:58 +01:00
Daniel Hofstetter
246da0d0d9
Merge pull request #7587 from drinkcat/stat-debug
stat: Print what kind of "weird" mode it is, if it's "weird"
2025-03-28 11:03:33 +01:00
Nicolas Boichat
4cecad3e35 uucore: format: num_format: add fmt function tests
All the other tests directly called format_float_* functions,
bypassing the additional logic in `fmt` (negative numbers, padding,
etc.).

This also tests the `parse` function in `mod.rs`, which calls back
into `try_from_spec` here. This also makes it easier to test a lot
of different format combinations without having to do end-to-end
tests in `test_printf.rs`.

Also add broken tests for the issues in #7509 and #7510.
2025-03-27 14:41:26 +01:00
Nicolas Boichat
afbab45350 uucore: format: Workaround BigDecimal printing bug with 0
This is a bigdecimal issue, see
https://github.com/akubera/bigdecimal-rs/issues/144 .

Also add a few tests, including a disabled one (our workaround
is _before_ the call to format_float_decimal).
2025-03-27 14:41:26 +01:00
Daniel Hofstetter
bf337a29af
Merge pull request #7592 from uutils/renovate/mozilla-actions-sccache-action-0.x
chore(deps): update mozilla-actions/sccache-action action to v0.0.9
2025-03-27 14:30:09 +01:00
renovate[bot]
47e7062ada
chore(deps): update mozilla-actions/sccache-action action to v0.0.9 2025-03-27 12:48:09 +00:00
Nicolas Boichat
78a006e1a1 ci: Enable workspace tests on MacOS 2025-03-27 10:29:46 +01:00
Nicolas Boichat
59396e32bc chcon/runcon: Only build on Linux
chcon/runcon rely on the selinux crate, that is empty on
non-Linux platforms.

This doesn't matter for normal builds that use the default features
for the platform (explicitly trying to build them will fail though).

This is a problem when using `cargo test --workspace` though,
as that tries to build all packages, including uu_chcon/uu_runcon.

Just prevent compilation of these source files when target_os != linux.
2025-03-27 10:29:46 +01:00
Nicolas Boichat
2555fd4039 Cargo.toml: We moved to edition 2024, drop = from fts-sys 2025-03-27 10:29:46 +01:00
Daniel Hofstetter
35a923b076
Merge pull request #7588 from uutils/renovate/clap-4.x-lockfile
chore(deps): update rust crate clap to v4.5.34
2025-03-27 07:09:20 +01:00
renovate[bot]
73a4d0d54e
chore(deps): update rust crate clap to v4.5.34 2025-03-27 02:29:50 +00:00
Nicolas Boichat
3d0c59ae97 stat: Print what kind of "weird" mode it is, if it's "weird"
Maybe useful to (partially) understand what is going on in #7583.
2025-03-26 20:20:50 +01:00
Sylvestre Ledru
f03cbf2cbb
Merge pull request #7582 from drinkcat/cspell-all
ci: Enable cspell on test on dotfiles too
2025-03-26 17:26:46 +01:00
Nicolas Boichat
28bfac3c3c ci: Enable cspell on test on dotfiles too
Noticed this because pre-commit would try to run on dotfiles as
well (will CI ignored it)
2025-03-26 16:50:08 +01:00
Nicolas Boichat
b92144180f dotfiles: Add works to cspell dictionary
Also fix a couple of real spelling mistakes.
2025-03-26 16:49:21 +01:00
Mohammad AlSaleh
410da77d43 sort: expand numeric sort section in BENCHMARKING.md a bit
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2025-03-26 12:12:56 +03:00
Mohammad AlSaleh
fd38fd69e9 sort: immediately compare whole lines if they parse as numbers
Numeric sort can be relatively slow on inputs that are wholly or
 mostly numbers. This is more clear when comparing with the speed of
 GeneralNumeric.

 This change parses whole lines as f64 and stores that info in
 `LineData`. This is faster than doing the parsing two lines at
 a time in `compare_by()`.

 # Benchmarks

 `shuf -i 1-1000000 -n 1000000 > /tmp/shuffled.txt`

 % hyperfine --warmup 3 \
     '/tmp/gnu-sort -n /tmp/shuffled.txt'
     '/tmp/before_coreutils sort -n /tmp/shuffled.txt'
     '/tmp/after_coreutils sort -n /tmp/shuffled.txt'
 Benchmark 1: /tmp/gnu-sort -n /tmp/shuffled.txt
   Time (mean ± σ):     198.2 ms ±   5.8 ms    [User: 884.6 ms, System: 22.0 ms]
   Range (min … max):   187.3 ms … 207.4 ms    15 runs

 Benchmark 2: /tmp/before_coreutils sort -n /tmp/shuffled.txt
   Time (mean ± σ):     361.3 ms ±   8.7 ms    [User: 1898.7 ms, System: 18.9 ms]
   Range (min … max):   350.4 ms … 375.3 ms    10 runs

 Benchmark 3: /tmp/after_coreutils sort -n /tmp/shuffled.txt
   Time (mean ± σ):     175.1 ms ±   6.7 ms    [User: 536.8 ms, System: 21.6 ms]
   Range (min … max):   169.3 ms … 197.0 ms    16 runs

 Summary
   /tmp/after_coreutils sort -n /tmp/shuffled.txt ran
     1.13 ± 0.05 times faster than /tmp/gnu-sort -n /tmp/shuffled.txt
     2.06 ± 0.09 times faster than /tmp/before_coreutils sort -n /tmp/shuffled.txt

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
2025-03-26 12:12:56 +03:00
Sylvestre Ledru
d33d731804
Merge pull request #7548 from lewisboon/bugfix/date-negative-offset
date: allow negative date offsets
2025-03-26 08:49:46 +01:00
Sylvestre Ledru
1898032213
Merge pull request #7577 from drinkcat/pre-commit-cspell
.pre-commit-config.yaml: Also run cspell
2025-03-26 08:48:59 +01:00
Sylvestre Ledru
5754d63a6b
Merge pull request #7574 from drinkcat/ci-uudoc
ci: Enable uudoc feature on x86-64 native builder
2025-03-26 08:47:59 +01:00
Sylvestre Ledru
9ce9e3e918
Merge pull request #7575 from cakebaker/deny_toml_remove_two_crates
deny.toml: remove two crates from skip list
2025-03-26 08:47:38 +01:00
Sylvestre Ledru
68515b5d3b
Merge pull request #7579 from drinkcat/test_file_N
test_test: Simplify test_file_N
2025-03-26 08:47:18 +01:00
Karl McDowall
9957d0a64e head: fix bug with non-terminated files.
Fixes issue #7472.
Update to head app when printing all-but-last-n-lines of a file.
Code now checks if the last line of the input file is missing a terminating
newline character, and if so prints an extra line.
This aligns with GNU-head behavior.
Also improved performance of this usecase by using an optimized iterator
(memchr-iter) for searching through the input file.
2025-03-25 14:20:08 -06:00
Nicolas Boichat
5263e0e2dc ci: Enable uudoc feature on x86-64 native builder
Make sure we catch build errors.

Would prevent #7572 from happening again.
2025-03-25 19:56:46 +01:00
Daniel Hofstetter
5a0988c28d
Merge pull request #7420 from uutils/renovate/fts-sys-0.x
chore(deps): update rust crate fts-sys to v0.2.16
2025-03-25 16:25:01 +01:00
Daniel Hofstetter
163907e134
Merge pull request #7421 from uutils/renovate/selinux-0.x
chore(deps): update rust crate selinux to v0.5.1
2025-03-25 15:24:14 +01:00
Nicolas Boichat
6b8135119c test_test: Simplify test_file_N
I found the logic a little difficult to understand, and the
comment probably doesn't match what `-N` is supposed to do?

Intead, let's just manually set mtime and atime.

Hopefully this helps clear up Android flakiness in #7570. Or at
least understand better what is going on.
2025-03-25 15:01:23 +01:00