1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2026-01-18 11:11:10 +00:00
Commit graph

980 commits

Author SHA1 Message Date
Alexander Shirokov
4c330d43ba
uucore:format:fix floating-point rounding
This change resolves issues with exponent calculation and usage,
ensuring more accurate formatting:

- Exponent for negative values can differ from 0
- Switching to decimal mode now follows the P > X ≥ −4 rule
2024-12-31 13:19:43 +01:00
Jeffrey Finkelstein
cccab35337 seq: improve error handling for invalid -f values
Improve the error message produced by `seq` when given invalid format
specifiers for the `-f` option. Before this commit:

    $ seq -f "%" 1
    seq: %: invalid conversion specification
    $ seq -f "%g%" 1
    seq: %: invalid conversion specification

After this commit:

    $ seq -f "%" 1
    seq: format '%' ends in %
    $ seq -f "%g%" 1
    seq: format '%g%' has too many % directives

This matches the behavior of GNU `seq`.
2024-12-30 12:30:26 -05:00
Daniel Hofstetter
dddbc17c59
Merge pull request #7017 from sylvestre/chmod-L
ch*: Remove duplicate declarations + start to plug it to chmod too
2024-12-29 17:03:13 +01:00
Sylvestre Ledru
438c3c93b2
Merge pull request #6965 from DaringCuteSeal/install-stream
install: implement copying from streams
2024-12-29 16:42:24 +01:00
Sylvestre Ledru
e45c56b926 ch*: also remove duplications for deref & no deref 2024-12-29 16:32:59 +01:00
Sylvestre Ledru
6de5aa7ac7 ch*: improve the presentation 2024-12-29 16:32:59 +01:00
Sylvestre Ledru
836351dd7a ch*: refactor duplicate declarations 2024-12-29 16:32:59 +01:00
Daringcuteseal
a45731eed8
uucore/buf_copy: delete empty doc-string 2024-12-29 20:10:53 +07:00
Sylvestre Ledru
48eb8d8703
Add procps to the spell ignore list 2024-12-29 10:20:34 +01:00
Dorian Péron
0a0db41a2c chore(clippy): fix clippy warnings 2024-12-29 04:40:07 +01:00
Pearl
edf8be5e08
uucore/buf_copy: Improve the uucore integration (#6983)
---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2024-12-28 15:30:10 +01:00
Sylvestre Ledru
2deeb7882c xattr feature: enable it on mac too 2024-12-26 17:25:12 +01:00
Daniel Hofstetter
392c48002c cut: don't merge adjacent ranges 2024-12-22 15:07:04 +01:00
Sylvestre Ledru
bb2fb66073
Merge pull request #6882 from jtracey/quoting_style_bytes
quoting_style: Add support for non-UTF-8 bytes
2024-12-21 23:17:43 +01:00
Justin Tracey
db1ed4c094
core: improve OsStr(ing) helpers
This adds the `os_str_as_bytes_lossy` function, for when we want infallible
conversion across platforms, and improves the doc comments of similar functions
to be more accurate and better formatted.
2024-12-19 17:10:16 -05:00
Santeri Paavolainen
2ae914b268
uucore: correctly truncate response if getgroups shrinks (#6978)
The code above this line handles the case if `res` is
larger than `ngroups`, but `res < ngroups` is also a possibility,
which this line attempts to address but actually does not.

The original code resizes to `ngroups` which is a no-op (given
that `groups` is already `ngroups` size). The correct target for
re-sizing the `groups` is the result from the last `getgroups`,
i.e., `res`.
2024-12-19 13:54:24 +01:00
Daringcuteseal
625c49d0fe
uucore: add common splice-write functionality
Splice is a Linux-specific syscall that allows direct data copying from
    one file descriptor to another without user-space buffer. As of now, this
    is used by `cp`, `cat`, and `install` when compiled for Linux and Android.
2024-12-19 18:32:11 +07:00
Justin Tracey
43229ae104
quoting_style: use and return OsStrings
This exposes the non-UTF-8 functionality to callers. Support in `argument`,
`spec`, and `wc` are implemented, as their usage is simple. A wrapper only
returning valid unicode is used in `ls`, since proper handling of OsStrings
there is more involved (outputs that escape non-unicode work now though).
2024-12-18 15:28:39 -05:00
Justin Tracey
2331600f4c
quoting_style: fix multi-byte control characters 2024-12-18 15:28:28 -05:00
Justin Tracey
355103134b
quoting_style: add support for non-unicode bytes
This new functionality is implemented, but not yet exposed here.
2024-12-18 15:28:18 -05:00
Sylvestre Ledru
beb56b10ab clippy: fix clippy warnings
See:
https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or
2024-12-17 22:46:21 +01:00
Daniel Hofstetter
209ec0b817
Merge pull request #6929 from RenjiSann/cksum-fixes
cksum: even more fixes
2024-12-12 10:16:48 +01:00
Dorian Péron
958222a07c test(cksum): un-ignore tests that are now implemented 2024-12-12 09:49:53 +01:00
Dorian Péron
567bbc5f3c checksum: remove ALGO_BASED_REGEX (non base64) as its not useful anymore and introduce LineFormat struct 2024-12-12 09:49:53 +01:00
Dorian Péron
f4e5dc2e0f checksum: use the blake2b length as an hint to check the correctness of the expected digest 2024-12-12 09:49:53 +01:00
Dorian Péron
10a9b0bfbf checksum: split treatment of algo-based and non-algo based into separate functions 2024-12-10 13:09:04 +01:00
Dorian Péron
65ddccbeb6 checksum: avoid to recompute Regexps 2024-12-10 13:09:04 +01:00
Dorian Péron
ed15ca1d26 checksum: keep a cache of the first used regex for non-algo-based regexes 2024-12-10 13:09:04 +01:00
Christian Legnitto
2ca7c28cd9
Make Spec public 2024-12-09 22:01:36 -04:00
Dorian Péron
5cbe87620c checksum: move regex detection to the line level 2024-12-06 21:28:56 +01:00
Sylvestre Ledru
18496735da
Merge pull request #6923 from sylvestre/more-terms
uucore: add alacritty to the list of terminals that support colors
2024-12-04 14:05:00 +01:00
Sylvestre Ledru
a644724137 uucore: add foot to the list of terminals that support colors 2024-12-04 13:25:24 +01:00
Daniel Hofstetter
d878f6c774
Merge pull request #6907 from sylvestre/tr2
tr: generate an error for real if the input is a directory
2024-12-04 10:20:08 +01:00
Sylvestre Ledru
843c0c2c0f
Merge pull request #6119 from hamflx/fix/invalid-backup-numbered-path
mv: fix invalid numbered backup path
2024-12-03 23:13:39 +01:00
Sylvestre Ledru
3e4221a461 tr: generate an error for real if the input is a directory 2024-12-03 21:38:28 +01:00
Christian Legnitto
2d81463399
Make EscapedChar and friends pub 2024-12-02 10:50:48 -04:00
hamflx
6b32c30d57 mv: fix invalid numbered backup path 2024-12-02 10:22:55 +01:00
Simone Ragusa
4f422c1a3a uucore: add alacritty to the list of terminals that support colors
Any value of TERM with glob pattern `alacritty*` will be matched.

Fixes #6722
2024-12-02 10:03:52 +01:00
Sylvestre Ledru
9dec29f613
Merge pull request #6891 from cakebaker/uucore_perms_fix_todo
uucore/perms: use ORs instead of `match` (fix todo)
2024-12-02 10:01:10 +01:00
Sylvestre Ledru
41a3695b3f uucore: Fix a clippy warning
The following explicit lifetimes could be elided: 'a
2024-11-28 19:25:17 +01:00
Daniel Hofstetter
8692533790 uucore/perms: use ORs instead of match (fix todo) 2024-11-26 15:32:53 +01:00
Dorian Péron
cfc66f9f6f chore(checksum): fix clippy warnings in tests 2024-11-26 01:47:10 +01:00
Dorian Péron
ba7c02860e feat(checksum): odd number of hexa characters is wrong formatting 2024-11-26 01:47:10 +01:00
Dorian Péron
7c4724edc3 feat(checksum): refactor ChecksumResult to include more counters in it
- Add comments to explain what each field is counting
2024-11-26 01:47:10 +01:00
Dorian Péron
a0af49f2d8 feat(checksum): get rid of the properly_formatted variable 2024-11-26 01:47:10 +01:00
Dorian Péron
f3763ef190 feat(checksum): simplify get_expected_checksum
- Rename the function to emphasize its goal
- Do not pass the filename anymore, as it is only used to create an error, that may be done in the scope calling the function
- Change the return type to Option, as the error is made in the outer scope
- Don't try to decode the base64 string as UTF8 string. This most oftenly fails and is wrong.
- Get rid of the `bytes_to_hex` function, as it provides the same functionality as `hex::encode`
2024-11-26 01:47:10 +01:00
Dorian Péron
a3b7403550 feat(checksum): improve FileCheckError variants to be meaningful 2024-11-26 01:47:10 +01:00
Daniel Hofstetter
cfe2c9f6da uucore: remove div_ceil() from sum feature 2024-11-20 09:20:41 +01:00
Dorian Péron
a09c7cc0d2 feat(checksum): add doc 2024-11-16 22:44:08 +01:00
Dorian Péron
5309b65867 feat(checksum): change process_checksum_line return type to Result<(), LineCheckError>
- Treat digest mismatch as an error
2024-11-16 22:44:08 +01:00