Daniel Eades
ba45fe312a
use 'Self' and derive 'Default' where possible
2022-01-30 15:08:26 +01:00
Daniel Eades
2f85610cc3
remove explicit iter loops
2022-01-30 15:08:26 +01:00
Daniel Eades
cf24620d3d
remove 'let and return'
2022-01-30 15:08:26 +01:00
Daniel Eades
784f2e2ea1
use semicolons if nothing returned
2022-01-30 15:08:26 +01:00
Daniel Eades
a2d5f06be4
remove needless pass by value
2022-01-30 15:08:26 +01:00
Daniel Eades
8bb6c4effa
use pointer args
2022-01-30 14:01:21 +01:00
Daniel Eades
f2074140ec
use 'char' instead of 'str' for single character patterns
2022-01-30 14:01:21 +01:00
Daniel Eades
5af66753af
remove needless borrows
2022-01-30 14:01:21 +01:00
Sylvestre Ledru
2f6f6867c5
Merge branch 'main' into 2940
2022-01-30 13:33:35 +01:00
Sylvestre Ledru
57dc11e586
Merge pull request #2871 from jfinkels/split-settings-methods
...
split: add a method to convert ArgMatches to Settings
2022-01-30 11:31:58 +01:00
Sylvestre Ledru
81b2a240e6
Merge pull request #2960 from water-ghosts/fix-cp-a-panic
...
Don't panic when calling cp -a with a nonexistent file
2022-01-30 11:30:56 +01:00
Sylvestre Ledru
bfa2d8b7da
Merge pull request #2875 from kimono-koans/ls_bad_fd_2
...
ls: Fix display of bad file descriptor errors
2022-01-30 09:59:58 +01:00
Sylvestre Ledru
7c1abdb7d9
Merge pull request #2866 from jfinkels/split-number-2
...
split: implement -n option
2022-01-30 09:58:04 +01:00
Sylvestre Ledru
b8b642101f
Merge pull request #2898 from jfinkels/tail-lines-zero-terminated
...
tail: support zero-terminated lines in streams
2022-01-30 09:44:04 +01:00
Eli Youngs
680e9081fe
Don't panic when calling cp -a with a nonexistent file
2022-01-29 22:59:53 -08:00
Dan Klose
bb7f37e8b4
fix: update itertools 0.8.0 -> 0.10.0
...
Targets https://github.com/uutils/coreutils/issues/2940
* since versions were mxing versions of x.y and x.y.z I changed all to x.y.z
* minor whitespace formatting
2022-01-29 22:35:51 +00:00
Terts Diepraam
eb82015b23
all: change macros
...
- Change the main! proc_macro to a bin! macro_rules macro.
- Reexport uucore_procs from uucore
- Make utils to not import uucore_procs directly
- Remove the `syn` dependency and don't parse proc_macro input (hopefully for faster compile times)
2022-01-29 15:26:32 +01:00
Sylvestre Ledru
1dcd3b2c24
Merge pull request #2943 from jfinkels/truncate-no-such-dir
...
truncate: better error msg when dir does not exist
2022-01-29 12:25:38 +01:00
Sylvestre Ledru
52ab6325a0
Merge pull request #2881 from jtracey/join-null-field-sep
...
join: add support for `-t '\0'`
2022-01-29 10:55:04 +01:00
Sylvestre Ledru
196a7a921c
Merge pull request #2877 from jfinkels/head-use-uucore-error-handling
...
head: use uucore error handling instead of custom
2022-01-29 10:53:48 +01:00
Sylvestre Ledru
24744ca42b
Merge pull request #2911 from jfinkels/dd-seek-stdout
...
dd: support seek=N when destination is stdout
2022-01-29 10:47:17 +01:00
Sylvestre Ledru
57ee6b5302
Merge branch 'main' into truncate-no-such-dir
2022-01-29 09:58:17 +01:00
Sylvestre Ledru
cbc7da3d7d
Merge pull request #2936 from tertsdiepraam/clap-infer-long-args
...
all: enable infer long arguments in clap
2022-01-29 09:57:15 +01:00
Sylvestre Ledru
bd44c59043
Merge pull request #2945 from jfinkels/truncate-reduce-underflow
...
truncate: prevent underflow when reducing size
2022-01-29 09:55:29 +01:00
Sylvestre Ledru
52b7a725ed
Merge pull request #2938 from sylvestre/selinux-dep
...
selinux: add consistency in the dep declaration
2022-01-29 09:46:16 +01:00
Jeffrey Finkelstein
0454d3b243
truncate: prevent underflow when reducing size
...
Prevent usize underflow when reducing the size of a file by more than
its current size. For example, if `f` is a file with 3 bytes, then
truncate -s-5 f
will now set the size of the file to 0 instead of causing a panic.
2022-01-28 22:44:07 -05:00
Jeffrey Finkelstein
c780c96e17
truncate: better error msg when dir does not exist
...
Improve the error message that gets printed when a directory does not
exist. After this commit, the error message is
truncate: cannot open '{file}' for writing: No such file or directory
where `{file}` is the name of a file in a directory that does not
exist.
2022-01-28 21:21:37 -05:00
Terts Diepraam
5f1933a89f
df: no longer override help
2022-01-29 02:06:32 +01:00
Terts Diepraam
9c8e865b55
all: enable infer long arguments in clap
2022-01-29 02:06:29 +01:00
Sylvestre Ledru
96584027e5
selinux: add consistency in the dep declaration
2022-01-29 01:31:17 +01:00
Sylvestre Ledru
f1d72018d7
Merge pull request #2923 from jfinkels/seq-error-zero-increment-value
...
seq: correct error message for zero increment
2022-01-29 01:25:57 +01:00
Sylvestre Ledru
c702154a84
Merge pull request #2934 from jfinkels/truncate-division-by-zero
...
truncate: add a division by zero error
2022-01-29 01:25:10 +01:00
Sylvestre Ledru
fed5ca4ba9
Merge pull request #2935 from tertsdiepraam/wc-unusual-files
...
wc: fix counting files from pseudo-filesystem
2022-01-29 01:09:02 +01:00
Sylvestre Ledru
b94bd96bc6
ignore spelling issue
2022-01-29 00:35:16 +01:00
Sylvestre Ledru
7f79fef2cd
fix various doc warnings
2022-01-29 00:09:09 +01:00
Terts Diepraam
dd311b294b
wc: fix counting files from pseudo-filesystem
2022-01-28 19:08:44 +01:00
electricboogie
72c53219e3
Prevent potential unwrap on a None value
2022-01-27 22:07:07 -06:00
Jeffrey Finkelstein
9dda23d8c6
seq: correct error message for zero increment
...
Change a word in the error message displayed when an increment value
of 0 is provided to `seq`. This commit changes the message from "Zero
increment argument" to "Zero increment value" to match the GNU `seq`
error message.
2022-01-27 21:17:27 -05:00
Jeffrey Finkelstein
b636ff04a0
split: implement -n option
...
Implement the `-n` command-line option to `split`, which splits a file
into a specified number of chunks by byte.
2022-01-27 21:16:27 -05:00
Jeffrey Finkelstein
1e5e637990
truncate: add a division by zero error
...
Add an error for division by zero. Previously, running `truncate -s /0
file` or `-s %0` would panic due to division by zero. After this
change, it writes an error message "division by zero" to stderr and
terminates with an error code.
2022-01-27 21:12:59 -05:00
Jeffrey Finkelstein
1074deeb03
truncate: make better use of UResult
...
Replace some uses of `crash!()` and move `UError` handling down into
the `truncate()` function. This does not change the behavior of the
program, just organizes the code to facilitate introducing code to
handle other types of errors in the future.
2022-01-27 21:05:34 -05:00
electricboogie
5e82d6069f
Fix comments
2022-01-27 16:12:34 -06:00
Sylvestre Ledru
b816e80e2f
Merge pull request #2912 from jfinkels/truncate-create-non-existent-file
...
truncate: create non-existent file by default
2022-01-27 23:03:55 +01:00
electricboogie
463c1ac2ff
Make suggested changes: Move logic into PathData struct, etc.
2022-01-27 11:57:19 -06:00
electricboogie
7512200ba2
Cleanup comments
2022-01-26 16:52:05 -06:00
electricboogie
1d629d8d66
Move more logic into md function, make enter_directory function clearer
2022-01-26 16:41:52 -06:00
Jeffrey Finkelstein
4fbe2b2b5e
seq: implement -f FORMAT option
...
Add support for the `-f FORMAT` option to `seq`. This option instructs
the program to render each value in the generated sequence using a
given `printf`-style floating point format. For example,
$ seq -f %.2f 0.0 0.1 0.5
0.00
0.10
0.20
0.30
0.40
0.50
Fixes issue #2616 .
2022-01-25 20:48:26 -05:00
Sylvestre Ledru
c7fc0a703b
Merge pull request #2893 from g-k/2888-rand-0.8
...
update rand crate to 0.8
2022-01-25 23:23:43 +01:00
Sylvestre Ledru
5932937952
Merge pull request #2777 from jfinkels/uucore-printf
...
uucore: move printf::memo module to uucore
2022-01-25 23:22:27 +01:00
Sylvestre Ledru
5c45911c13
Merge pull request #2915 from jfinkels/dd-status-noxfer
...
dd: correct behavior when status=noxfer
2022-01-25 23:19:53 +01:00
Jeffrey Finkelstein
e8df666c2e
dd: support seek=N when destination is stdout
...
Add support for the `seek=N` argument when the destination is stdout
and not a file. Previously, the argument was ignored when writing to
stdout.
2022-01-25 12:34:13 -05:00
Sylvestre Ledru
630b5d8577
Merge pull request #2909 from jfinkels/dd-conv-ascii-unblock
...
dd: block/unblock on ebcdic/ascii conversions
2022-01-25 14:37:20 +01:00
Sylvestre Ledru
b5df3723df
Merge pull request #2897 from tertsdiepraam/mdbook
...
Automatic mdBook Documentation
2022-01-25 14:33:41 +01:00
Sylvestre Ledru
1415ebc263
Merge pull request #2908 from cohosh/join_chkodr_default
...
join: fix default check order behaviour
2022-01-25 13:47:34 +01:00
Sylvestre Ledru
c74cfdc33e
Merge pull request #2916 from jfinkels/tail-follow-non-utf8-bytes
...
tail: don't error when following non-UTF-8 data
2022-01-25 13:47:16 +01:00
Sylvestre Ledru
e6733881d6
Merge pull request #2850 from sbentmar/numfmt-error-handling
...
numfmt: use UResult in more functions
2022-01-25 13:46:46 +01:00
Jeffrey Finkelstein
83f96ec29d
tail: don't error when following non-UTF-8 data
...
Fix a bug where `tail -f` would terminate with an error due to failing
to parse a UTF-8 string from a sequence of bytes read from the
followed file. This commit replaces the call to `BufRead::read_line()`
with a call to `BufRead::read_until()` so that any sequence of bytes
regardless of encoding can be read.
Fixes #1050 .
2022-01-24 21:32:52 -05:00
Greg Guthe
e6fdf0761f
factor: ignore quickcheck tests using unhandled large vals
...
refs: #1559
2022-01-24 20:51:10 -05:00
Greg Guthe
e24ecea1da
factor: tests: update Arbitrary impl for Factors
...
Upstream removed the Gen trait and made the gen method private in
d286e4db20
2022-01-24 20:41:22 -05:00
Greg Guthe
c037382df7
factor: update quickcheck dev dep to 1.0.3
...
quickcheck <1 uses rand 0.6.x which results in E0599 errors. Upgrading resolves that error and lets
us remove the older rand version from our deps.
refs: https://stackoverflow.com/questions/56901973/errore0599-no-method-named-gen-found-for-type-mut-g-in-the-current-scope/56902740#56902740
2022-01-24 20:41:20 -05:00
Greg Guthe
a6f8d1d9fd
shuf: fix crate relative import for vendored rand read adapter
2022-01-24 20:40:57 -05:00
Greg Guthe
2630894658
shuf: remove ReadRng deprecation notices
2022-01-24 20:40:57 -05:00
Greg Guthe
6bcca01e83
shuf: add deprecated rand crate ReadRng adapter
...
It is deprecated pending future removal. This version copied from:
https://github.com/rust-random/rand/blob/0.8.4/src/rngs/adapter/read.rs
2022-01-24 20:40:55 -05:00
Greg Guthe
a342df03f0
tests: update factor Distribution<Factors> sample to take range
2022-01-24 20:40:31 -05:00
Greg Guthe
cae6bc5e82
deps: update rand to 0.8
...
fix : #2888
2022-01-24 20:40:29 -05:00
Jeffrey Finkelstein
80ac2619e4
dd: correct behavior when status=noxfer
...
Correct the behavior of `dd` with the `status=noxfer` option. Before
this commit, the status output was entirely suppressed (as happens
with `status=none`). This was incorrect behavior. After this commit,
the input/output counts are printed to stderr as expected.
For example,
$ printf "" | dd status=noxfer
0+0 records in
0+0 records out
This commit also updates a unit test that was enforcing the wrong
behavior.
2022-01-23 17:36:14 -05:00
Terts Diepraam
d2fe245192
Merge pull request #2502 from hbina/hbina-tr-reimplement-expansion
...
`tr`: Expanding expansion module
2022-01-23 19:08:00 +01:00
Jeffrey Finkelstein
129cfe12b8
truncate: create non-existent file by default
...
Fix the behavior of truncate when given a non-existent file so that it
correctly creates the file before truncating it (unless the
`--no-create` option is also given).
2022-01-23 11:24:53 -05:00
Jeffrey Finkelstein
1c8df122d7
dd: block/unblock on ebcdic/ascii conversions
...
Update `dd` so that the conversion `conv=ascii` implies `conv=unblock`
and, symmetrically, the conversion `conv=ebcdic` implies `conv=block`.
2022-01-23 09:57:37 -05:00
Cecylia Bocovich
594157d1e0
join: fix default check order behaviour
...
If neither --nocheck-order or --check-order are specified, only fail on
unsorted inputs if either file contains unpaired lines.
2022-01-22 17:51:29 -05:00
Terts Diepraam
7014607f0a
Merge branch 'main' into mdbook
2022-01-22 12:42:19 +01:00
Jeffrey Finkelstein
f595edaded
tail: fix a bug in tail [ -n | -c ] +NUM <file>
...
Fix a bug when getting all but the first NUM lines or bytes of a file
via `tail -n +NUM <file>` or `tail -c +NUM <file>`. The bug only
existed when a file is given as an argument; it did not exist when the
input data came from stdin.
2022-01-21 19:05:53 -05:00
Jeffrey Finkelstein
d27d6bc32c
split: add forwards_thru_file() helper function
...
Add helper function `forwards_thru_file()` that finds the index in a
reader of the byte immediately following the `n`th instance of a given
byte.
2022-01-21 18:33:15 -05:00
Jeffrey Finkelstein
58d84d5107
tail: support zero-terminated lines in streams
...
Support `-z` option when the input is not a seekable file. Previously,
the option was accepted by the argument parser, but it was being
ignored by the application logic.
2022-01-21 18:31:15 -05:00
Sylvestre Ledru
8c298e97a5
expr: Fix a warning in the doc generation ( #2900 )
...
```
warning: this URL is not a hyperlink
```
2022-01-21 23:14:05 +01:00
Terts Diepraam
ab3623f65a
docs: usage and values for options
2022-01-21 19:20:55 +01:00
Cecylia Bocovich
67878de379
join: print unsorted line in error message
...
This expands the error message that is printed if either input file has
an unsorted line. Both the program name (join) and the offending line
are printed out with the message to match the behaviour of the GNU
utility.
2022-01-21 11:47:37 -05:00
Terts Diepraam
9ddd61ab6b
Merge branch 'main' into hbina-tr-reimplement-expansion
2022-01-21 14:42:30 +01:00
Terts Diepraam
55a47f6fc0
Merge pull request #2863 from tertsdiepraam/clap-3
...
Clap 3
2022-01-20 23:14:52 +01:00
Sylvestre Ledru
d64b32d121
Merge pull request #2885 from jfinkels/head-find-nth-line-from-end
...
head: refactor helper function find_nth_line_from_end()
2022-01-20 21:53:47 +01:00
electricboogie
0b53cd8c4a
Make suggested changes
2022-01-20 14:52:45 -06:00
Terts Diepraam
b51a6e8fe3
tr: make parsing of sets more terse
2022-01-19 21:03:57 +01:00
Terts Diepraam
da728dd2b6
Merge branch 'main' into hbina-tr-reimplement-expansion
2022-01-19 19:34:13 +01:00
Terts Diepraam
6aa433c70a
tr: adapt copyright to new guidelines
2022-01-19 19:07:17 +01:00
Roy Ivy III
2e251f91f1
0.0.12
2022-01-19 05:35:00 -06:00
Jeffrey Finkelstein
ca812a7558
tail: rm trailing \n if input doesn't end with one
...
Fix a bug where `tail` would inappropriately add a newline to the last
line of output even though the input did not end with one.
2022-01-18 17:34:41 -05:00
Terts Diepraam
4b79419514
runcon/hashsum: remove references to get_matches_from_safe
2022-01-18 16:34:06 +01:00
Terts Diepraam
0a30c43bb6
chcon: use try_get_matches_from
2022-01-18 13:06:02 +01:00
Terts Diepraam
e345768484
base64: remove clap dependency again
2022-01-18 12:56:58 +01:00
Terts Diepraam
270a6ee83e
rm: fix 3 leading hyphens for ---presume-input-tty
2022-01-18 12:54:50 +01:00
Justin Tracey
ce3df12eaa
join: "support" field numbers larger than usize::MAX
...
They silently get folded to usize::MAX, which is the official GNU behavior.
2022-01-17 17:49:41 -05:00
Jeffrey Finkelstein
e575007629
tail: improve error handling when file not found
2022-01-17 10:57:24 -05:00
Jeffrey Finkelstein
0f1053ce68
head: refactor helper func find_nth_line_from_end
...
Factor out a loop for finding the index of the byte immediately
following the `n`th line from the end of a file. This does not change
the behavior of the code, just its organization.
2022-01-17 10:55:40 -05:00
Terts Diepraam
951f3bb689
fix up runcon and chcon for clap 3
2022-01-17 16:52:17 +01:00
Terts Diepraam
55893f0e3d
od: use clap options instead of custom mock options for unit tests
2022-01-17 16:25:49 +01:00
sbentmar
b0cf6f9b34
numfmt: minor adjustments to test cases
2022-01-17 16:24:40 +01:00
sbentmar
635c2d0c31
numfmt: remove unused function
2022-01-17 16:24:40 +01:00
sbentmar
1287ce3780
numfmt: add tests for handle_buffer
2022-01-17 16:24:40 +01:00
sbentmar
4a7d313712
numfmt: add unit test for io error
2022-01-17 16:24:40 +01:00
sbentmar
5cab4e41b3
numfmt: add copyright notice
2022-01-17 16:24:40 +01:00