Nicolas Boichat
27efb9eff4
seq: Parse integral and fractional number of digits in the same function
...
A lot of the code can be shared, and parsing is quite straightforward
as we know that the digit is somewhat valid.
2025-04-03 17:26:38 +02:00
Nicolas Boichat
77d66bab47
seq: Refactor to actually use PreciseNumber::num_fractional_digits
...
The field was unused, and actually redundant with the precision
computed separatedly.
This simplifies the code, reintroduces testing.
2025-04-03 17:26:38 +02:00
Nicolas Boichat
84e5ee4b86
seq: Accept underflow in parameters
...
Also, add a test to check that a very, very, small number is
treated as 0. That's probably undefined behaviour, but it does
make some sense.
2025-04-03 17:26:38 +02:00
Nicolas Boichat
686f1c7841
seq: Remove custom number parsing
...
Just use the format provided function.
2025-04-03 17:26:38 +02:00
Nicolas Boichat
d58f1cc0f1
test_seq: Modify undefined behaviour tests
...
GNU `seq` doesn't support such large positive exponents anyway,
and we are limited by i64 range, so increase the exponent value
to make sure we fully overflow that range.
Also, add a test to check that a very, very, small number is
treated as 0 (that's also undefined behaviour, but it does
make sense in a way).
2025-04-03 17:26:38 +02:00
Sylvestre Ledru
2cfed639d3
Merge pull request #7640 from cakebaker/clippy_fix_warnings_from_rust_1_86
...
clippy: fix warnings from Rust 1.86
2025-04-03 16:38:07 +02:00
Daniel Hofstetter
293554e358
yes: fix error from manual_repeat_n lint
2025-04-03 15:38:06 +02:00
Daniel Hofstetter
5ab4968721
dd: fix "unused import" warning in test
2025-04-03 14:27:43 +02:00
Daniel Hofstetter
59d7866dcf
uutests: fix clippy errors
...
from doc_overindented_list_items lint
2025-04-03 14:25:51 +02:00
Daniel Hofstetter
a8a43f73b0
clippy: fix errors from unnecessary_semicolon lint
2025-04-03 14:24:16 +02:00
Daniel Hofstetter
7eb267ddcd
Merge pull request #7639 from uutils/renovate/blake3-1.x-lockfile
...
chore(deps): update rust crate blake3 to v1.8.1
2025-04-03 09:41:49 +02:00
Daniel Hofstetter
7af2c94678
Merge pull request #7636 from karlmcdowall/cat_find_a_bug_fix_a_bug
...
cat: bugfix when running with -T option
2025-04-03 09:35:09 +02:00
renovate[bot]
b6d94a9c9c
chore(deps): update rust crate blake3 to v1.8.1
2025-04-03 07:08:17 +00:00
Karl McDowall
a4b621ad8a
cat: bugfix when running with -T option
...
Fixes an crash seen when running with -T option if no newline
is found in a buffer.
Added unit test to validate.
2025-04-02 18:59:27 -06:00
Chandra Kiran G
3a0b43bdf7
df: add thiserror ( #7545 )
...
* refactor: Add thiserror to df
* fix: Try fixing tests
* refactor(df): Move `df` to `thiserror`
* chore(df): Add back comment
* chore: Refactor column.rs correctly
2025-04-02 10:19:19 +02:00
Daniel Hofstetter
dd5517c1ff
Merge pull request #7634 from uutils/sylvestre-patch-5
...
remaining-gnu-error.py: Adjust to the new URL
2025-04-02 07:34:25 +02:00
Sylvestre Ledru
0f4ea79229
remaining-gnu-error.py: Adjust to the new URL
2025-04-01 21:39:01 +02:00
Sylvestre Ledru
48cbcc44f4
Merge pull request #7628 from cakebaker/bump_iana_time_zone
...
Bump `iana-time-zone` & add `windows-core` to skip list
2025-04-01 21:30:32 +02:00
Sylvestre Ledru
cd4d75bfad
Merge pull request #7630 from cakebaker/bump_bigdecimal
...
Bump `bigdecimal` & fix failing test
2025-04-01 21:29:52 +02:00
Sylvestre Ledru
1071847198
Merge pull request #7633 from uutils/renovate/clap-4.x-lockfile
...
chore(deps): update rust crate clap to v4.5.35
2025-04-01 21:28:51 +02:00
renovate[bot]
642b739339
chore(deps): update rust crate clap to v4.5.35
2025-04-01 18:40:14 +00:00
Daniel Hofstetter
60ebace7f2
uucore/format: remove TODOs related to bigdecimal
2025-04-01 17:29:28 +02:00
Daniel Hofstetter
636e4a777b
uucore/format: remove Display impl
...
of ExtendedBigDecimal
2025-04-01 17:08:04 +02:00
Daniel Hofstetter
eaa8332be4
Bump bigdecimal from 0.4.7 to 0.4.8
2025-04-01 15:02:30 +02:00
Dorian Péron
17d81bb9a1
Merge pull request #7623 from drinkcat/parse-bigdecimal-smallfixes
...
uucore: format: Collection of small parser fixes
2025-04-01 12:36:28 +02:00
Dorian Péron
fb165850a4
Merge pull request #7567 from MoSal/faster_sort_n
...
sort: immediately compare whole lines if they parse as numbers
2025-04-01 12:14:29 +02:00
Dorian Péron
e4fa68c57d
Merge pull request #7629 from cakebaker/uptime_fix_unused_import_warning
...
uptime: fix "unused import" warning in test
2025-04-01 12:09:39 +02:00
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
Daniel Hofstetter
7b6d05f81d
uptime: fix "unused import" warning in test
2025-04-01 09:21:38 +02:00
Daniel Hofstetter
3fded2a12e
deny.toml: update comments
2025-04-01 08:15:18 +02:00
Daniel Hofstetter
2b31be039c
deny.toml: add windows-core to skip list
2025-04-01 08:07:50 +02:00
Daniel Hofstetter
aa3b3a7eac
Bump iana-time-zone from 0.1.62 to 0.1.63
2025-04-01 08:03:00 +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