Commit graph

7084 commits

Author SHA1 Message Date
353fc443 aka Seagull
8ccc45c68c
mkdir: recursive reporting of created directories in verbose mode (#3217) 2022-03-06 21:36:08 +01:00
Davide Cavalca
19af43222b Include license text in all published crates 2022-03-05 21:21:46 +01:00
Renovate Bot
5683d0fba0 chore(deps): add renovate.json 2022-03-05 21:08:21 +01:00
xxyzz
6174cad334 Run GNU coverage job on pull requests
GNU coverage job now takes around one hour to finish thanks to contributors' work. Run it on pull requests to compare the GNU coverage report.
2022-03-05 13:49:35 +01:00
Jeffrey Finkelstein
d0ebd1c9d0 df: add support for --total option
Add support for the `--total` option to `df`, which displays the total
of each numeric column. For example,

    $ df --total
    Filesystem            1K-blocks     Used Available Use% Mounted on
    udev                    3858016        0   3858016   0% /dev
    ...
    /dev/loop14               63488    63488         0 100% /snap/core20/1361
    total                 258775268 98099712 148220200  40% -
2022-03-05 10:29:46 +01:00
Jeffrey Finkelstein
41acdb5471 df: borrow Row in DisplayRow::new()
Change the signature of `DisplayRow::new()` to borrow `Row` instead of
consuming it, so that the `Row` can be used after it is displayed.
2022-03-05 10:29:46 +01:00
Jeffrey Finkelstein
3fb36d02e3 df: add unit tests for internal helper functions
Add unit tests in the `df.rs` file for internal helper functions
`mount_info_lt()`, `is_best()`, `is_included()`, and
`filter_mount_list()`.
2022-03-05 10:28:37 +01:00
Sylvestre Ledru
f3bd1f3020 Add onehundredlines in the spell ignore 2022-03-05 10:27:51 +01:00
Jeffrey Finkelstein
ee36dea1a9 split: implement outputting kth chunk of file
Implement `-n l/k/N` option, where the `k`th chunk of the input file
is written to stdout. For example,

    $ seq -w 0 99 > f; split -n l/3/10 f
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
2022-03-05 10:27:51 +01:00
Terts Diepraam
bb379b5384 pr: fix heuristic for number-lines argument (#3109) 2022-03-05 10:26:12 +01:00
Terts Diepraam
75b3cbcfd9 pr: move from getopts to clap
fixes
2022-03-05 10:26:12 +01:00
Sylvestre Ledru
1c10ed7171
Merge pull request #3212 from uutils/sylvestre-patch-1
Update to ubuntu latest for cross compilation
2022-03-04 20:35:12 +01:00
Sylvestre Ledru
91852d9768
Update to ubuntu latest until https://github.com/uutils/coreutils/issues/3210 is fixed 2022-03-04 12:52:57 +01:00
Hanif Ariffin
30a174e6e4
realpath: Error when resolved symlink is absolute and ENOENT (#3037)
* realpath: Match behavior where resolving symlinks with absolute path is an error if ENOENT

This PR changes `realpath` to match the behavior in GNU where,

```shell
hbina@akarin ~/Documents> mkdir dir1
hbina@akarin ~/Documents> mkdir dir2
hbina@akarin ~/Documents> touch dir2/bar
hbina@akarin ~/Documents> ln -s ../dir2/bar dir1/foo1
hbina@akarin ~/Documents> ln -s /dir2/bar dir1/foo2
hbina@akarin ~/Documents> ln -s ../dir2/baz dir1/foo3
hbina@akarin ~/Documents> realpath ./dir1/foo1 ./dir1/foo2 ./dir1/foo3
/home/hbina/Documents/dir2/bar
realpath: ./dir1/foo2: No such file or directory
/home/hbina/Documents/dir2/baz
```

Currently, our `realpath` will happily print the second one out,

```shell
hbina@akarin ~/Documents> ~/git/uutils/target/debug/coreutils realpath ./dir1/foo1 ./dir1/foo2 ./dir1/foo3
/home/hbina/Documents/dir2/bar
/dir2/bar
/home/hbina/Documents/dir2/baz
```

Closes https://github.com/uutils/coreutils/issues/3036

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-03-03 23:06:15 +01:00
Eli Youngs
eace4bc907
cp: Support copying FIFOs with -r (#3032) 2022-03-03 22:58:27 +01:00
Terts Diepraam
618a268f61
Merge pull request #3081 from HeroicKatora/main
Discuss seq parsing
2022-03-03 22:50:32 +01:00
Sylvestre Ledru
66e9956595
Merge pull request #3156 from jfinkels/dd-cbs-blocks
dd: pad partial record with spaces in some cases
2022-03-03 22:35:58 +01:00
Sylvestre Ledru
1c023c6523
Merge pull request #3202 from cakebaker/patch-1
cp: fix typo in help text
2022-03-01 10:14:06 +01:00
Sylvestre Ledru
346cfa060b
Merge pull request #2980 from jfinkels/split-lines-2
split: add support for "-n l/NUM" option to split
2022-03-01 10:13:44 +01:00
Daniel Hofstetter
5cce2b0d9a
cp: fix typo in help text 2022-02-28 15:16:47 +01:00
Sylvestre Ledru
bbef777c8c
Merge pull request #2998 from tertsdiepraam/cp-override-args
`cp`: override args instead of having them conflict
2022-02-28 14:47:53 +01:00
Sylvestre Ledru
95765dcd2c
Merge pull request #3199 from jfinkels/df-safe-statfs
df: use safe wrapper function for statfs() func.
2022-02-28 13:47:04 +01:00
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