Nicolas Boichat
bdc8cd12a1
uucore: format: Remove TODO
...
Not much more that can be easily simplified now.
2025-04-01 11:20:17 +02:00
Nicolas Boichat
a46da8d0b9
uucore: format: num_parser: Allow uppercase exponent
...
1E3 and 0x1P3 are acceptable numbers.
Sprinkle uppercase values in the tests.
2025-04-01 11:20:17 +02:00
Nicolas Boichat
16131b8d7b
uucore: format: num_parser: underflow/overflow check
...
When parsing floating point numbers, return errors if we end up
overflowing/underflowing BigDecimal (e.g. with large/small exponents).
2025-04-01 11:20:17 +02:00
Nicolas Boichat
1e104b7ef9
uucore: format: num_parser: Add value to Overflow error
...
When parsing integers, we should still return the min/max value
of the type (depending on the type), and wrap that in the error.
We need to refactor the map function to handle this case better,
and add an extract function to get the value out of an error
(if any).
This fixes the integer part of #7508 .
2025-04-01 11:20:17 +02:00
Nicolas Boichat
9872263a96
uucore: format: Fix i64::MIN printing
...
-i64::MIN overflows i64, so cast to i128 first.
2025-04-01 11:20:17 +02:00
Nicolas Boichat
5bea6ff013
uucore: format: num_parser: Carve out part of parse function
...
We'll need more logic in there.
2025-04-01 11:20:17 +02:00
Nicolas Boichat
0cb37c83b9
uucore: format: num_parser: "infinity" string parsing
...
Not just "inf" is allowed, also "infinity".
2025-04-01 11:20:17 +02:00
Nicolas Boichat
5c06dd580b
uucore: format: extendedbigdecimal: Implement Neg trait
...
This is useful and will simplify some of the parsing logic later.
2025-04-01 11:20:17 +02:00
Dorian Péron
ace92dcca1
Merge pull request #7556 from drinkcat/parse-bigdecimal
...
uucore: format: num_parser: Use ExtendedBigDecimal
2025-04-01 10:52:50 +02:00
Daniel Hofstetter
1fe764230f
Merge pull request #7611 from drinkcat/stat-disable-macosx
...
test_stat: Disable test_stdin_pipe_fifo1/2 on Mac OS X
2025-04-01 09:42:01 +02:00
Dorian Péron
6675460d1d
Merge pull request #7580 from GTimothy/cksum_no_regex
...
cksum: take out regex pattern matching
2025-04-01 02:10:42 +02:00
GTimothy
09a9dc72b9
checksum/cksum: fix: filename that include separator should parse + add tests
...
fixes this non-regex implementation's flaw with file_names containing
the separator's pattern:
- replaces left-to-right greedy separator match with right-to-left one.
- added bugfix tests
fixes secondary bug: positive match on hybrid posix-openssl format
adds secondary bugfix tests
Co-authored-by: Dorian Péron
<72708393+RenjiSann@users.noreply.github.com>
2025-03-31 17:18:18 +02:00
GTimothy
04ad55510b
checksum/cksum: update tests to test new parsers not regex
2025-03-31 17:18:18 +02:00
GTimothy
621f2b5c7a
checksum/cksum: rewrite lineformat parsing without regex
...
removes dependency on the regex crate for LineFormat detection and
parsing, resulting in a faster and lighter cksum binary.
2025-03-31 17:18:18 +02:00
Nicolas Boichat
30c89af9ac
uucore: format: num_parser: Make it clear that scale can only be positive
...
After scratching my head a bit about why the hexadecimal code works,
seems better to do make scale an u64 to clarify.
Note that this may u64 may exceed i64 capacity, but that can only
happen if the number of digits provided > 2**63 (impossible).
2025-03-31 10:04:08 +02:00
Nicolas Boichat
bd68eb8beb
uucore: format: num_parser: Parse exponent part of floating point numbers
...
Parse numbers like 123.15e15 and 0xfp-2, and add some tests
for that.
`parse` is becoming more and more of a monster: we should consider
splitting it into multiple parts.
Fixes #7474 .
2025-03-31 10:04:08 +02:00
Nicolas Boichat
55773e9d35
uucore: format: num_parser: Fix large hexadecimal float parsing
...
Large numbers can overflow u64 when doing 16u64.pow(scale):
do the operation on BigInt/BigDecimal instead.
Also, add a test. Wolfram Alpha can help confirm the decimal number
is correct (16-16**-21).
2025-03-31 10:04:08 +02:00
Nicolas Boichat
b5a658528b
uucore: format: Use ExtendedBigDecimal in argument code
...
Provides arbitrary precision for float parsing in printf.
Also add a printf test for that.
2025-03-31 10:04:08 +02:00
Nicolas Boichat
71a285468b
uucore: format: num_parser: Add parser for ExtendedBigDecimal
...
Very simple as the f64 parser actually uses that as intermediary
value.
Add a few tests too.
2025-03-31 10:04:08 +02:00
Nicolas Boichat
d7502e4b2e
uucore: format: num_parser: Disallow binary number parsing for floats
...
Fixes #7487 .
Also, add more tests for leading zeros not getting parsed as octal
when dealing with floats.
2025-03-31 10:04:08 +02:00
Nicolas Boichat
97e333c6d9
uucore: format: num_parser: allow leading + sign when parsing
...
Leading plus signs are allowed for all formats.
Add tests (including some tests for negative i64 values, and mixed
case special values that springed to mind).
Fixes #7473 .
2025-03-31 10:04:08 +02:00
Nicolas Boichat
40a7c65980
uucore: format: num_parser: Turn parser into a trait
...
We call the function extended_parse, so that we do not clash
with other parsing functions in other traits.
- Also implement parser for ExtendedBigDecimal (straightforward).
- Base doesn't need to be public anymore.
- Rename the error to ExtendedParserError.
2025-03-31 10:04:08 +02:00
Nicolas Boichat
8bbec16115
uucore: format: num_parser: Fold special value parsing in main parsing function
2025-03-31 10:04:08 +02:00
Nicolas Boichat
20add88afc
uucore: format: num_parser: Use ExtendedBigDecimal for internal representation
...
ExtendedBigDecimal already provides everything we need, use that
instead of a custom representation.
2025-03-31 10:04:08 +02:00
Daniel Hofstetter
07cce029cb
Merge pull request #7621 from uutils/renovate/blake3-1.x-lockfile
...
chore(deps): update rust crate blake3 to v1.8.0
2025-03-31 08:46:31 +02:00
renovate[bot]
b89be8c9a7
chore(deps): update rust crate blake3 to v1.8.0
2025-03-31 05:52:26 +00:00
Solomon Victorino
e20500d1e5
numfmt: move to thiserror
2025-03-30 21:15:21 +02:00
Solomon Victorino
4f1d33fec3
dd: move to thiserror
2025-03-30 21:15:21 +02:00
Solomon Victorino
047d9a930b
wc/BufReadDecoderError: move to thiserror
2025-03-30 21:15:21 +02:00
Solomon Victorino
9099f342e0
unexpand: move to thiserror
2025-03-30 21:15:21 +02:00
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