1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-13 10:37:58 +00:00
Commit graph

4055 commits

Author SHA1 Message Date
Dorian Peron
5250b893a7 test(env): fix test_gnu_e20 for coverage run 2025-04-07 10:19:00 +02:00
Dorian Peron
f552a6cb8a test-utils: make the test harness forward LLVM_PROFILE_FILE to coreutil call 2025-04-07 10:19:00 +02:00
eduardorittner
36ef5010e3 printf: make negative values wrap around with unsigned/hex format
To convert from negative to unsigned with overflow, we get the two's complement
representation of the absolute (unsigned) value.
2025-04-06 18:58:56 -03:00
shskwmt
58bde5453d test/cp: Fix "No such file or directory" error in test_acl_preserve
Fix a bug in test_acl_preserve that was causing "setfacl: a: No such file or directory"
error messages when running with `cargo test --features=cp test_acl_preserve`.

Changes:
- Use plus_as_string on path1 to generate the correct absolute path
- Move the file path generation closer to where it's used for better code organization
2025-04-06 23:50:14 +09:00
Joseph Jon Booker
6061b67601 printf: add tests for different octal lengths 2025-04-05 02:02:33 -05:00
Joseph Jon Booker
95e5396c4c printf: Consistently handle negative widths/precision
Also allows character constants with " instead of ', and for
interpolated values with %b to use \0XXX notation for octal bytes
2025-04-05 02:02:31 -05:00
Sylvestre Ledru
88cf66174f
Merge pull request #7648 from drinkcat/parse_time-ebd
timeout: Use common parser to parse time duration
2025-04-04 23:46:48 +02:00
Sylvestre Ledru
295628a2e9
Merge pull request #7631 from drinkcat/format-hex-default
uucore: format: Fix hexadecimal default format print
2025-04-04 23:44:35 +02:00
Nicolas Boichat
edc213d2c7 test_timeout: Add tests for very short timeouts
Note that unlike GNU coreutils, any value > 0 will not be treated
as 0, even if the exponent is very large.
2025-04-04 18:23:17 +02:00
Nicolas Boichat
e0a6482759 seq: Trim whitespaces, then try to remove +
Otherwise, `seq` crashes with ` 0xee.` as input.

Also update one of the tests to catch that.
2025-04-04 17:09:33 +02:00
Nicolas Boichat
ae3756b434 seq: Do not allow -w and -f to be specified at the same time
Fixes #7466.
2025-04-04 10:17:17 +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
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
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
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
Nicolas Boichat
8cf4da0b19 uucore: format: Fix hexadecimal default format print
The default hex format, on x86(-64) prints 15 digits after the
decimal point, _but_ also trims trailing zeros, so it's not just
a simple default precision and a little bit of extra handling is
required.

Also add a bunch of tests.

Fixes #7364.
2025-04-01 15:04:47 +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
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
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
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
Jan Verbeek
a9cd3f132e uniq: Flush BufWriter, make error context GNU-like 2025-03-31 13:46:33 +02:00
Jan Verbeek
181844eafa tr: Flush BufWriter, fix double error context
Write errors led with `tr: tr: write error:`.
2025-03-31 13:46:33 +02:00
Jan Verbeek
cf50952325 tail: Flush BufWriter 2025-03-31 13:46:33 +02:00
Jan Verbeek
11ef1522ca tac: Flush BufWriter 2025-03-31 13:46:24 +02:00
Jan Verbeek
d456e90596 sort: Flush BufWriter, don't panic on write errors 2025-03-31 13:46:15 +02:00
Jan Verbeek
bfdde70309 ptx: Flush BufWriter, add context to errors 2025-03-31 13:46:05 +02:00
Jan Verbeek
cba48c0284 cut: Flush BufWriter, centralize output file logic 2025-03-31 13:45:10 +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
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
8be432e6ef uutests: fix the doc 2025-03-29 09:28:54 +01: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
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
d33d731804
Merge pull request #7548 from lewisboon/bugfix/date-negative-offset
date: allow negative date offsets
2025-03-26 08:49:46 +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
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
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
85c5d39fd7 add setpriority to the spell ignore 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
2739c19330 Fix unsafe attribute used without unsafe 2025-03-24 21:00:53 +01:00
Sylvestre Ledru
e0fbced116 rust edition 2021 => 2024 2025-03-24 21:00:35 +01:00
Dan Robertson
1a0bc30f17 printf: trim leading whitespace when parsing numeric values
Trim leading whitespace from numeric input to printf.
2025-03-24 16:27:58 +00:00