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
Nicolas Boichat
e6c24b245a uucore: format: Small optimizations in num_format for seq
In most common use cases:
 - We can bypass a lot of `write_output` when width == 0.
 - Simplify format_float_decimal when the input is an integer.

Also document another interesting case in src/uu/seq/BENCHMARKING.md.
2025-03-22 21:13:18 +01:00
Nicolas Boichat
f31ba2bd28 seq: Make use of uucore::format to print in all cases
Now that uucore format functions take in an ExtendedBigDecimal,
we can use those in all cases.
2025-03-22 21:13:18 +01:00
Nicolas Boichat
25c492ee19 uucore: format: Pad non-finite numbers with spaces, not zeros
`printf "%05.2f" inf` should print `  inf`, not `00inf`.

Add a test to cover that case, too.
2025-03-22 21:13:18 +01:00
Nicolas Boichat
ec450d602a uucode: format: format_float_hexadecimal: Take in &BigDecimal
Display hexadecimal floats with arbitrary precision.

Note that some of the logic will produce extremely large
BitInt as intermediate values: there is some optimization
possible here, but the current implementation appears to work
fine for reasonable numbers (e.g. whatever would previously
fit in a f64, and even with somewhat large precision).
2025-03-22 21:13:18 +01:00
Nicolas Boichat
f0e9b8621f uucode: format: format_float_shortest: Take in &BigDecimal
Similar logic to scientific printing. Also add a few more tests
around corner cases where we switch from decimal to scientific
printing.
2025-03-22 21:13:18 +01:00
Nicolas Boichat
7f0e5eb473 uucode: format: format_float_scientific: Take in &BigDecimal
No more f64 operations needed, we just trim (or extend) BigDecimal to
appropriate precision, get the digits as a string, then add the
decimal point.

Similar to what BigDecimal::write_scientific_notation does, but
we need a little bit more control.
2025-03-22 21:13:18 +01:00
Nicolas Boichat
edaccc88b9 uucode: format: format_float_decimal: Take in &BigDecimal
Also add a few unit tests to make sure precision is not lost anymore.
2025-03-22 21:13:18 +01:00
Nicolas Boichat
ce14d01da5 uucode: format: format_float_non_finite: Take in &ExtendedBigDecimal
First modify Format.fmt to extract absolute value and sign, then
modify printing on non-finite values (inf or nan).
2025-03-22 21:13:18 +01:00
Nicolas Boichat
8e11dab995 uucode: format: Change Formatter to take an &ExtendedBigDecimal
Only changes the external interface, right now the number is
casted back to f64 for printing. We'll update that in follow-up.
2025-03-22 21:13:18 +01:00
Nicolas Boichat
241e2291bd uucore: format: extendedbigdecimal: Implement From<f64>
Allows easier conversion.
2025-03-22 21:13:18 +01:00
Nicolas Boichat
9355200901 uucore: format: extendedbigdecimal: Add MinusNan
Some test cases require to handle "negative" NaN. Handle it
similarly to "positive" NaN.
2025-03-22 21:13:18 +01:00
Nicolas Boichat
69164688ad uucore: format: Make Formatter a generic
Using an associated type in Formatter trait was quite nice, but, in
a follow-up change, we'd like to pass a _reference_ to the Float
Formatter, while just passing i64/u64 as a value to the Int
formatters. Associated type doesn't allow for that, so we turn
it into a generic instead.

This makes Format<> a bit more complicated though, as we need
to specify both the Formatter, _and_ the type to be formatted.
2025-03-22 21:13:18 +01:00
Nicolas Boichat
2103646ff7 seq: Move extendedbigdecimal.rs to uucore/features/format
Will make it possible to directly print ExtendedBigDecimal in `seq`,
and gradually get rid of limited f64 precision in other tools
(e.g. `printf`).

Changes are mostly mechanical, we reexport ExtendedBigDecimal directly
in format to keep the imports slightly shorter.
2025-03-22 21:13:18 +01:00
Daniel Hofstetter
b4a9b89f4a
docs: fix url of file with coverage results (#7528) 2025-03-22 17:11:26 +01:00
Valerio
6658a0e610
Add test to ensure arch output is not empty (#7523)
* Add test to ensure arch output is not empty

This test ensures that the output of the arch command is non-empty, which is a minimal expectation across all supported architectures.

This helps avoid regressions or edge cases where the command might unexpectedly return an empty string on unsupported or misconfigured platforms.

* Update tests/by-util/test_arch.rs

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

* Apply cargo fmt formatting

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-03-22 15:15:28 +01:00
usamoi
412d2b3b1f ptx: fixes 2025-03-22 19:25:19 +08:00
Sylvestre Ledru
302f7842c7 ci: if FAIL => PASS but in the intermittent list, show the info
see:
https://github.com/uutils/coreutils/pull/7522#issuecomment-2744892884
2025-03-22 11:04:20 +01:00
Karl McDowall
c84ee0ae0f cat: Improve performance of formatting.
Issue #7518
Add a BufWriter over stdout when cat outputs any kind of formattted
data. This improves performance considerably.
2025-03-21 19:03:34 -06:00
Daniel Hofstetter
a64fce8286
Merge pull request #7517 from sylvestre/fix-intermittent-detection
GNU CI: fix the intermittement management
2025-03-21 17:04:02 +01:00
Sylvestre Ledru
fe2d19be6a GNU CI: fix the intermittement management 2025-03-21 12:04:43 +01:00
jmjoy
7bd90bb663
Implement Default for Options of mv and cp (#7506) 2025-03-20 16:08:44 +01:00
Sylvestre Ledru
187d3e58b5
Merge pull request #7495 from karlmcdowall/wc_perf
wc: Perf gains with the bytecount crate.
2025-03-20 09:52:15 +01:00
Daniel Hofstetter
1983b579c7
Merge pull request #7500 from uutils/renovate/tempfile-3.x-lockfile
fix(deps): update rust crate tempfile to v3.19.1
2025-03-20 07:31:52 +01:00
Daniel Hofstetter
b2864e8e1d
Merge pull request #7499 from uutils/renovate/clap_complete-4.x-lockfile
chore(deps): update rust crate clap_complete to v4.5.47
2025-03-20 07:12:38 +01:00
Karl McDowall
eea6c82305 wc: Perf gains with the bytecount crate.
Issue #7494
Improve performace of wc app.
 - Use the bytecount::num_chars API to count UTF-8 characters in a file.
 - Enable runtime-dispatch-simd feature in the bytecount crate.
2025-03-19 16:45:19 -06:00
renovate[bot]
fd488ecff8
fix(deps): update rust crate tempfile to v3.19.1 2025-03-19 22:22:41 +00:00
renovate[bot]
d02f27b84b
chore(deps): update rust crate clap_complete to v4.5.47 2025-03-19 22:22:32 +00:00
Sylvestre Ledru
b8779c5edb
Merge pull request #7368 from bloxx12/main
flake: drop flake-utils, refactor
2025-03-19 11:20:15 +01:00
Sylvestre Ledru
09f4e60e93
Merge pull request #7485 from drinkcat/seq-buffered
seq: Buffer writes to stdout
2025-03-19 11:18:07 +01:00
Nicolas Boichat
6d3c0bee68 seq: Buffer writes to stdout
Use a BufWriter to wrap stdout: reduces the numbers of system calls,
improves performance drastically (2x in some cases).

Also document use cases in src/uu/seq/BENCHMARKING.md, and the
optimization we have just done here.
2025-03-19 10:36:48 +01:00
Sylvestre Ledru
c197a4203c
Merge pull request #7493 from cakebaker/python_fix_formatting
python: fix formatting in `compare_test_results.py`
2025-03-19 09:46:33 +01:00
Daniel Hofstetter
53ed1a58cb python: fix formatting in compare_test_results.py 2025-03-19 09:07:35 +01:00
Daniel Hofstetter
fc46a041f8
Merge pull request #7486 from sylvestre/python
Python: add ruff check and fix the code
2025-03-19 08:07:43 +01:00
Daniel Hofstetter
4df6423ba8
Merge pull request #7491 from uutils/renovate/zip-2.x-lockfile
chore(deps): update rust crate zip to v2.4.2
2025-03-19 07:20:58 +01:00
Sylvestre Ledru
38aee73fe5
GNU/CI: use the aggregated-result.json files and move to python (#7471)
* GNU/CI: use the aggregated-result.json files and move to python

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

* simplify code

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

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2025-03-19 07:15:11 +01:00
Daniel Hofstetter
c3098cce35
Merge pull request #7489 from uutils/renovate/blake3-1.x-lockfile
chore(deps): update rust crate blake3 to v1.7.0
2025-03-19 07:10:26 +01:00
renovate[bot]
cf54e9b1f9
chore(deps): update rust crate zip to v2.4.2 2025-03-19 02:55:33 +00:00
renovate[bot]
8dd4eb2f21
chore(deps): update rust crate blake3 to v1.7.0 2025-03-18 21:57:51 +00:00
Sylvestre Ledru
b1c3175387 fix ruff warnings 2025-03-18 20:52:46 +01:00
Sylvestre Ledru
663a9202e5 ruff: reformat python code 2025-03-18 20:52:46 +01:00
Sylvestre Ledru
e61898897d Github action: run ruff on the python code 2025-03-18 20:52:46 +01:00
Dorian Péron
2e3da88b78
Merge pull request #7438 from karlmcdowall/head_perf2
head: rework handling of non-seekable files
2025-03-18 18:15:01 +01:00
karlmcdowall
e1275f4ccd
Update src/uu/head/src/take.rs
Co-authored-by: Dorian Péron <72708393+RenjiSann@users.noreply.github.com>
2025-03-18 09:08:21 -06:00
Terakomari
ae6d4dec28
base32/base64/basenc: add -D flag (#7479)
* base32/base64/basenc: add -D flag

* base32/base64/basenc: add test for -D flag

* update extensions.md

* remove redundant parameters

* merge  into a single category

* Update docs/src/extensions.md

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2025-03-18 14:39:53 +01:00
Sylvestre Ledru
eb8928af48
Merge pull request #7478 from uutils/renovate/time-0.x-lockfile
chore(deps): update rust crate time to v0.3.40
2025-03-18 09:30:38 +01:00
renovate[bot]
95fd100d82
chore(deps): update rust crate time to v0.3.40 2025-03-18 07:31:00 +00:00
Sylvestre Ledru
6610e66b0d
Merge pull request #7477 from sylvestre/selinux4
github: fix the name - it is reference/aggregated-result.json/aggregated-result.json otherwise
2025-03-18 08:29:38 +01:00
Sylvestre Ledru
340fafb870 github: fix the name - it is reference/aggregated-result.json/aggregated-result.json otherwise 2025-03-18 07:52:15 +01:00
Daniel Hofstetter
e687a65c88
Merge pull request #7476 from uutils/renovate/zip-2.x-lockfile
chore(deps): update rust crate zip to v2.4.1
2025-03-18 07:15:52 +01:00
renovate[bot]
63a56fbc63
chore(deps): update rust crate zip to v2.4.1 2025-03-17 22:54:26 +00:00