1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-15 11:36:16 +00:00
Commit graph

15910 commits

Author SHA1 Message Date
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
renovate[bot]
611a320396
chore(deps): update rust crate fts-sys to v0.2.16 2025-03-25 13:25:38 +00:00
Nicolas Boichat
4a959d4bdd .pre-commit-config.yaml: Also run cspell
That cuaght me a few times... I think it's reasonable to ask devs
to install cspell locally if they want to use the pre-commit hook.
2025-03-25 13:57:08 +01:00
Daniel Hofstetter
db8b84fc06 deny.toml: remove two crates from skip list
bindgen & rustc-hash
2025-03-25 13:46:32 +01:00
renovate[bot]
bde8165f7f
chore(deps): update rust crate selinux to v0.5.1 2025-03-25 12:39:47 +00:00
Daniel Hofstetter
3530c4c41b
Merge pull request #7424 from uutils/renovate/selinux-sys-0.x
chore(deps): update rust crate selinux-sys to v0.6.14
2025-03-25 13:38:28 +01:00
Sylvestre Ledru
2488e17aef
Merge pull request #7571 from cakebaker/hostid_use_libc
hostid: use `gethostid` from Rust `libc`
2025-03-25 13:20:24 +01:00
Sylvestre Ledru
765a8b54bc
Merge pull request #7573 from drinkcat/uudoc-fix
uudoc: Fix for edition 2024
2025-03-25 13:11:01 +01:00
Nicolas Boichat
5d53da9f3e uudoc: Fix for edition 2024
This change is documented here: https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html

I'm... not sure to understand everything, but this change is what
`cargo fix --edition --features="uudoc" --allow-dirty`
suggests.

Fixes #7572.
2025-03-25 12:16:28 +01:00
Daniel Hofstetter
b0e0059251
Merge pull request #7568 from uutils/sylvestre-patch-5
flake.nix: bump minial rust version
2025-03-25 10:55:54 +01:00
renovate[bot]
4a3b034457
chore(deps): update rust crate selinux-sys to v0.6.14 2025-03-25 09:55:08 +00:00
Daniel Hofstetter
df7427b834
Merge pull request #7343 from uutils/renovate/hex-literal-1.x
chore(deps): update rust crate hex-literal to v1
2025-03-25 10:53:27 +01:00
Daniel Hofstetter
2a0bfb8bd5 hostid: use gethostid from Rust libc 2025-03-25 10:40:51 +01:00
Sylvestre Ledru
0522576ae6
flake.nix: bump minial rust version 2025-03-25 10:00:07 +01:00
renovate[bot]
944cd4f72c
chore(deps): update rust crate hex-literal to v1 2025-03-25 08:37:05 +00:00
Daniel Hofstetter
f038d3e716
Merge pull request #7423 from sylvestre/rust-2024
bump to Rust edition 2024 & min = 1.85
2025-03-25 09:30:03 +01:00
Lewis Boon
b02e3d587d date: allow negative date offsets
Issue #7515
Clap needs to be specifically configured to allow values
with a leading hyphen.
2025-03-24 22:03:38 +00:00
Sylvestre Ledru
22fc5cf16b dd tests: fix 'temporary value dropped while borrowed' 2025-03-24 21:33:16 +01:00
Sylvestre Ledru
b4ac10769d add some missing unsafe 2025-03-24 21:33:16 +01:00
Sylvestre Ledru
85c5d39fd7 add setpriority to the spell ignore 2025-03-24 21:33:16 +01:00
Sylvestre Ledru
d671849b7f uucore: set the unsafe at the right place 2025-03-24 21:33:16 +01:00
Sylvestre Ledru
a85539f530 Run cargo fmt on the tree 2025-03-24 21:33:12 +01:00
Sylvestre Ledru
36dd968c9a head: fix an iterator 2025-03-24 21:03:58 +01:00
Sylvestre Ledru
39f5c394a7 Fix 'does not live long enough' 2025-03-24 21:03:10 +01:00
Sylvestre Ledru
b1d676d3b5 add missing unsafe around extern 2025-03-24 21:03:00 +01:00