Commit graph

7164 commits

Author SHA1 Message Date
Jeffrey Finkelstein
7273d1f100 df: use safe wrapper function for statfs() func.
Replace unsafe code with a safe version of the `statfs()` function
provided by `uucore`.
2022-02-27 17:33:01 -05:00
Sylvestre Ledru
3b48d1273a
Merge pull request #3187 from ndd7xv/install-error-msg
install: better error messages when handling invalid arguments
2022-02-26 18:57:17 +01:00
Terts Diepraam
9aca050e4a cp: override args
These arguments should not have been in conflict with each other, but silently override each other.
2022-02-26 10:37:58 +01:00
ndd7xv
47be40afae install: add tests for error handling 2022-02-25 21:17:43 -05:00
DevSabb
b8a3795d95
tr: fix octal interpretation of repeat count string (#3178)
* tr: fix octal interpretation of repeat count string

* tr: fix formatting errors

* tr: fix formatting issues 2

* tr: attempt to bypass spell check error

* tr: fix spell check errors attempt 2

* tr: formatting fixes

Co-authored-by: DevSabb <devsabb@local>
2022-02-25 12:11:53 +01:00
Sylvestre Ledru
629e1f7c4e
Merge pull request #3189 from tertsdiepraam/clippy-1.59
Rust 1.59 Clippy lints
2022-02-25 10:07:33 +01:00
Terts Diepraam
722c5d268f fix Rust 1.59 clippy lints 2022-02-25 09:39:48 +01:00
ndd7xv
172be3a8c6 install: better error messages when invalid arguments
executing `install` or `install file` no longer panics and insteads returns errors similar to GNU's install when it encounters similar args
2022-02-24 17:58:32 -05:00
Sylvestre Ledru
c9be7ccf89
Merge pull request #3186 from jfinkels/df-doc-links
df: correct links in BlockSize documentation
2022-02-24 08:34:20 +01:00
Jeffrey Finkelstein
9f71b7ac7f df: correct links in BlockSize documentation 2022-02-23 21:08:35 -05:00
Sylvestre Ledru
d3ca49128d
Merge pull request #3179 from omertuc/test_u64
Improve coverage / error messages from `parse_size` PR
2022-02-23 18:27:14 +01:00
Sylvestre Ledru
6224a08978
Merge pull request #3182 from jfinkels/df-scale-by-block-size
df: correctly scale bytes by block size
2022-02-23 10:03:33 +01:00
Jeffrey Finkelstein
fc8e9f20ea df: correctly scale bytes by block size
Change `df` so that it correctly scales numbers of bytes by the
default block size, 1024, when neither -h nor -H are specified on the
command-line. Previously, it was not scaling the number of bytes in
this case.

Fixes #3058.
2022-02-22 22:51:26 -05:00
Jeffrey Finkelstein
dbbee573ab split: add support for "-n l/NUM" option to split
Add support for `split -n l/NUM`. Previously, `split` only supported
`-n NUM`, which splits a file into `NUM` chunks by byte. The `-n
l/NUM` strategy splits a file into `NUM` chunks without splitting
lines across chunks.
2022-02-22 18:44:08 -05:00
Jeffrey Finkelstein
92d461247e split: extend Strategy::Number to add NumberType
Make the `Strategy::Number` enumeration value more general by
replacing the number parameter with a `NumberType` enum parameter.
This allows a future commit to update `split` to support the various
sub-strategies for the `-n`. (This commit does not add support for the
other sub-strategies.)
2022-02-22 18:41:29 -05:00
Omer Tuchfeld
0ce22f3a08 Improve coverage / error messages from parse_size PR
https://github.com/uutils/coreutils/pull/3084 (2a333ab391) had some
missing coverage and was merged before I had a chance to fix it.

This PR adds some coverage / improved error messages that were missing
from that previous PR.
2022-02-22 22:09:45 +01:00
Sylvestre Ledru
2a333ab391
Merge pull request #3084 from omertuc/u64
Fix `parse_size` to use u64 rather than usize for better 32-bit support
2022-02-22 20:47:38 +01:00
Sylvestre Ledru
e95a8e2ec9
Merge pull request #3175 from alextibbles/hashsum-update-md5
Hashsum consolidate md5 with RustCrypto Hashes
2022-02-22 20:38:38 +01:00
Omer Tuchfeld
f3895124b9 Remove impractical test creating a file too large 2022-02-22 14:23:46 +01:00
Omer Tuchfeld
fa60898354 Adjust 32-bit tests for tail,split,truncate,head 2022-02-22 13:49:20 +01:00
Omer Tuchfeld
e9adf979d9 Fix type-error when calling parse_size from stdbuf 2022-02-22 13:49:20 +01:00
Omer Tuchfeld
468ff8f0b9 Fix type-error when calling parse_size from od 2022-02-22 13:49:20 +01:00
Gilad Naaman
6856c5dba5 Fix type-error when calling parse_size from truncate 2022-02-22 13:49:20 +01:00
Gilad Naaman
159a1dc1db Fix type-error when calling parse_size from split 2022-02-22 13:49:20 +01:00
Gilad Naaman
8535cd41e0 Fix type-error when calling parse_size from sort 2022-02-22 13:49:20 +01:00
Omer Tuchfeld
5d861df961 Fix type-error when calling parse_size from tail 2022-02-22 13:49:20 +01:00
Omer Tuchfeld
8d8e25880e Fix type-error when calling parse_size from head 2022-02-22 13:49:20 +01:00
Omer Tuchfeld
0fe6017006 Fix type-error when calling parse_size from du 2022-02-22 13:49:20 +01:00
Omer Tuchfeld
88dfb8d374 Fix type-error when calling parse_size from dd 2022-02-22 13:49:15 +01:00
Omer Tuchfeld
b6c952c46e Fix parse_size to use u64 rather than usize for better 32-bit support
Using usize limits 32-bit platforms to operate only on sizes of 4GiB
or less. While 32-bit platforms only have 4GiB of addressable memory,
not all operations require the data to be entirely in memory, so this
limitation can be lifted if we use u64 instead of usize.

This only fixes the core function, further commits fix the utilities
making use of this function.
2022-02-22 11:09:40 +01:00
Alex Tibbles
163472ff7b
hashsum: pass spell checker 2022-02-21 20:43:42 -05:00
Alex Tibbles
3a0f292510
hashsum: refactor macro name 2022-02-21 17:04:57 -05:00
Alex Tibbles
afd5fea3c8
hashsum: refactor MD5 to use macro 2022-02-21 17:00:34 -05:00
Alex Tibbles
b1c543b4d2
hashsum: re-factor SHA1 implementation into common macro 2022-02-21 16:58:20 -05:00
Alex Tibbles
00d3c36e8c
update SHA1, SHA2, SHA3 crates 2022-02-21 16:55:59 -05:00
Alex Tibbles
41e9719d6b
upgrade to RustCrypto Hashes MD5 "MD-5" 0.10.1 2022-02-21 16:51:00 -05:00
Sylvestre Ledru
38bcafb7c2
Merge pull request #3174 from alextibbles/hashsum-update-hex
hashsum: update hex to 0.4.3
2022-02-21 22:23:03 +01:00
Alex Tibbles
c8346fd720
hashsum: update hex to 0.4.3
Update to API change.
2022-02-21 15:35:46 -05:00
Sylvestre Ledru
6c7decc42b
Merge pull request #3172 from alextibbles/update-strum
uniq: update strum to 0.23 latest
2022-02-21 19:28:55 +01:00
Sylvestre Ledru
775588fb18
Merge pull request #3127 from xxyzz/df
df: some option changes
2022-02-21 19:08:56 +01:00
Jeffrey Finkelstein
9f367b72e6 dd: pad partial record with spaces in some cases
If `conv=block,sync` command-line arguments are given and there is at
least one partial record read from the input (for example, if the
length of the input is not divisible by the value of the `ibs`
argument), then output an extra block of `cbs` spaces.

For example, no extra spaces are printed in this example because the
input is of length 10, a multiple of `ibs`:

    $ printf "012\nabcde\n" \
    > | dd ibs=5 cbs=5 conv=block,sync status=noxfer \
    > && echo $
    012  abcde$
    2+0 records in
    0+1 records out

But in this example, 5 extra spaces are printed because the length of
the input is not a multiple of `ibs`:

    $ printf "012\nabcdefg\n" \
    > | dd ibs=5 cbs=5 conv=block,sync status=noxfer \
    > && echo $
    012  abcde     $
    2+1 records in
    0+1 records out
    1 truncated record

The number of spaces printed is the size of the conversion block,
given by `cbs`.
2022-02-21 13:00:11 -05:00
Alex Tibbles
0d5dd27e71
uniq: update strum to 0.23 latest 2022-02-21 12:34:25 -05:00
Sylvestre Ledru
f11ac4b076
Merge pull request #3166 from sylvestre/rust-cache
try to use rust-cache on github action to build faster
2022-02-21 17:35:22 +01:00
Terts Diepraam
53070141c1
all: add format_usage function (#3139)
This should correct the usage strings in both the `--help` and user documentation. Previously, sometimes the name of the utils did not show up correctly.
2022-02-21 17:14:03 +01:00
alextibbles
cd450cc591
expr: update onig crate to 6.3 (#3136)
* expr: update onig crate to 6.3
2022-02-21 17:13:27 +01:00
Sylvestre Ledru
419abec4e5
Merge pull request #3148 from jfinkels/dd-of-dev-null
dd: don't error when outfile is /dev/null
2022-02-21 17:10:42 +01:00
Sylvestre Ledru
8583ed8272
Merge pull request #3169 from xxyzz/main
Run GNU root tests after other tests
2022-02-21 11:12:31 +01:00
Sylvestre Ledru
8e0a40d6b1
Merge pull request #3170 from jfinkels/dd-blocks-module
dd: move block-related functions into new module
2022-02-21 10:51:23 +01:00
Jeffrey Finkelstein
1076fbd492 dd: move block-related functions into new module
Create a new module `blocks.rs` to contain the block-related helper
functions. This commit only moves the location of the code and related
tests, it does not change the functionality of `dd`.
2022-02-20 22:16:54 -05:00
Terts Diepraam
938c5acbbe
Merge pull request #3146 from ndd7xv/split-suffix-check
split: error when num. of chunks is greater than num. of possible filenames
2022-02-20 17:12:05 +01:00