Commit graph

2336 commits

Author SHA1 Message Date
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
Sebastian Holgersson
9b04c98ddb numfmt: use UResult in more functions
This commit replaces generic Results with UResults in some key
functions in numfmt. As a result of this, we can provide different
exit codes for different errors, which resolves ~70 failing test
cases in the GNU numfmt.pl test suite.
2022-01-17 16:24:40 +01:00
Jeffrey Finkelstein
ab4036297b head: use uucore error handling instead of custom
Use `show!()` and `USimpleError` to handle I/O errors instead of using
custom code.
2022-01-17 08:58:44 -05:00
Jeffrey Finkelstein
58f2000406 split: method to convert ArgMatches to Settings
Create a `Settings::from` method that converts a `clap::ArgMatches`
instance into a `Settings` instance. This eliminates the unnecessary
use of a mutable variable when initializing the settings.
2022-01-17 08:58:10 -05:00
Jeffrey Finkelstein
d9afdf0527 uucore: move printf::memo module to uucore
Move the `printf::memo` module to `uucore` so that it can be used by
other programs, not just `printf`. For example, the `-f` option to `seq`
requires parsing and formatting numbers according to the same logic as
`printf`.
2022-01-17 08:46:45 -05:00
Jeffrey Finkelstein
2d66c84413 printf: remove cli module
Remove the cli module from the printf crate and move its functions into
the module tokenize::unescaped_text module, the only place they are
used.
2022-01-17 08:43:36 -05:00
Terts Diepraam
8872485922 Merge branch 'main' into clap-3 2022-01-17 13:25:51 +01:00
Terts Diepraam
08efa1fe5a
Merge branch 'main' into join-null-field-sep 2022-01-17 12:59:52 +01:00
Sylvestre Ledru
a87a71893f
Merge pull request #2879 from sylvestre/chrono-issue
Force minimal version of chrono to avoid a security issue
2022-01-17 12:53:31 +01:00
Justin Tracey
109277d405 join: add support for -t '\0' 2022-01-16 18:05:58 -05:00
Justin Tracey
346415e1d2 join: add support for -z option 2022-01-16 17:56:07 -05:00
Sylvestre Ledru
fcff6fec6d Force minimal version of chrono to avoid a security issue
See: https://rustsec.org/advisories/RUSTSEC-2020-0071.html
2022-01-16 23:33:12 +01:00
Sylvestre Ledru
4fc47aba61
Merge pull request #2878 from tertsdiepraam/stdbuf-trouble
`stdbuf`: fix `cargo publish` problem
2022-01-16 23:23:35 +01:00
Sylvestre Ledru
516bdfcfd5
Merge pull request #2872 from jfinkels/split-verbose
split: add --verbose option
2022-01-16 23:19:30 +01:00
Terts Diepraam
c5e2515833 fix stdbuf problem 2022-01-16 22:50:34 +01:00
electricboogie
16b7b38b92 Run cargo fmt 2022-01-16 11:17:43 -06:00
electricboogie
e6ce049d2c Fix Windows lints/build errors 2022-01-16 11:07:22 -06:00
electricboogie
e1bffea595 Merge branch 'master' into ls_bad_fd_2 2022-01-16 10:26:44 -06:00
electricboogie
15efba54c5 Use dir_entry metadata for dereferenced bad fds to match GNU, add comments, clippy lints 2022-01-16 10:20:50 -06:00
Sylvestre Ledru
1fbda8003c coreutils 0.0.8 => 0.0.9, uucore_procs 0.0.7 => 0.0.8, uucore 0.0.10 => 0.0.11 2022-01-16 17:05:48 +01:00
Sylvestre Ledru
00c11b184f
Merge pull request #2851 from jtracey/join-strless
join: operate on bytes instead of Strings
2022-01-16 16:24:38 +01:00
Terts Diepraam
448b84806f
fix Rust 1.58 clippy lints (#2874) 2022-01-16 15:57:33 +01:00
Jeffrey Finkelstein
7af3007204 split: add --verbose option 2022-01-16 09:34:28 -05:00
electricboogie
37ca6edfdc Fix display of bad fd errors 2022-01-15 22:39:07 -06:00
kimono-koans
fd5310411e
ls: Fix device display (#2855) 2022-01-15 00:39:56 +01:00
Sylvestre Ledru
3cc1fb593a
Merge pull request #2859 from jfinkels/split-dynamic-suffix-length
split: correct filename creation algorithm
2022-01-14 18:06:57 +01:00
Terts Diepraam
49e5412580 tsort: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
e62fdb9307 yes: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
fe69ad25f8 whoami: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
e3b8e6c993 who: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
e9e5768591 wc: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
e5a775be46 users: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
ac76eefb99 uptime: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
2cd32beb70 unlink 2022-01-11 19:16:48 +01:00
Terts Diepraam
5105a59fda uniq: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
dafa0737c8 unexpand: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
7de993fa4f uname: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
48c65934c7 tty: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
263357666f truncate: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
6c37cdebce true: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
fd777866a3 tr: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
9f58715d65 touch: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
7318d1d24b timeout: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
0ff1984471 test: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
3cac8a631f tee: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
9c9643807a tail: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
219498c2e8 tac: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
57361292aa sync: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
bad790840a sum: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
0fca4460de stdbuf: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
eaaa16291e stat: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
ecf6f18ab3 split: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
b43839a8a8 sort: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
d0a52c95e6 sleep: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
793e540323 shuf: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
92e94de2d7 shred: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
41513a8ba6 seq: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
ec42e824f0 runcon: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
4edab26dcc pr: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
f260f60093 rmdir: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
283973c5bf rm: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
a02e40fcad relpath: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
d52887e6c0 pwd: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
edafc468ed realpath: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
d8f2be2f3b readlink: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
24dc4d9037 ptx: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
b94809197f printf: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
8ba10936b0 printenv: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
c39a9b49d4 pinky: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
49b19972cc pathchk: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
8f7f3d18ee paste: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
9efd6654f8 od: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
7cebb2563b numfmt: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
5702313e9c nproc: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
5e9443567d nohup: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
5b13ec9c66 nl: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
64f57a9200 nice: clap 3 2022-01-11 19:16:48 +01:00
Terts Diepraam
ba93684a7e mv: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
41d567f44b more: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
f902ec7d6e mktemp: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
6e39eddbc1 mknod: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
c8eddad610 mkfifo: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
0e021e956a mkdir: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
c8270b202e ls: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
ebaf5caae8 logname: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
9951958b93 ln: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
0531f13cfd link: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
83f39619d5 kill: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
b61494337e join: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
89112fb1c2 install: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
8c58f8e2b1 id: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
82aadbf38f hostname: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
6876521b08 hostid: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
9fc9fdb1f3 head: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
6e34d8a53c hashsum: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
742fe8500c groups: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
ebe96f1454 fold: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
e3e35cb1a9 fmt: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
df5bf0c2a4 false: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
b5ba2fc5ca factor: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
55eb4a271b expr: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
449a536c59 expand: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
4d917e28b2 env: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
812f2db464 echo: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
1f2c3064b8 du: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
db1e630c6c dirname: clap 3 2022-01-11 19:16:47 +01:00
Terts Diepraam
9bd1c3e967 dircolors: clap 3 2022-01-11 19:16:47 +01:00