Commit graph

1026 commits

Author SHA1 Message Date
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
5c45911c13
Merge pull request #2915 from jfinkels/dd-status-noxfer
dd: correct behavior when status=noxfer
2022-01-25 23:19:53 +01: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
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
1e0dc6c278 tests: update test_random to take range
Fix 'error[E0061]: this function takes 1 argument but 2 arguments were supplied'.
2022-01-24 20:40:31 -05:00
Greg Guthe
771c9f5d9c tests: update random_chars generator to map u8 to char
Fix 'value of type `char` cannot be built from `std::iter::Iterator<Item=u8>`' for split test.

refs: https://docs.rs/rand/0.8.4/rand/distributions/struct.Alphanumeric.html#example
2022-01-24 20:40:31 -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
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
c8f9ea5b15
tests/join: test default check order behaviour 2022-01-22 17:51:29 -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
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
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
0c34e35fdb
Merge pull request #2896 from tertsdiepraam/flaky-tr-test
`tr`: fix flaky test
2022-01-20 21:53:27 +01:00
Terts Diepraam
9f649ffe9b tr: fix flaky test 2022-01-19 22:33:54 +01:00
Terts Diepraam
da728dd2b6 Merge branch 'main' into hbina-tr-reimplement-expansion 2022-01-19 19:34:13 +01: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
77229aea86 ls: fix tests for windows 2022-01-18 13:47:50 +01:00
Terts Diepraam
270a6ee83e rm: fix 3 leading hyphens for ---presume-input-tty 2022-01-18 12:54:50 +01:00
Jeffrey Finkelstein
e575007629 tail: improve error handling when file not found 2022-01-17 10:57:24 -05:00
sbentmar
413bff26f8 numfmt: ignore stdin write error 2022-01-17 16:24:40 +01:00
sbentmar
328cf4d91b numfmt: add more negative tests 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
Terts Diepraam
8872485922 Merge branch 'main' into clap-3 2022-01-17 13:25:51 +01:00
Justin Tracey
346415e1d2 join: add support for -z option 2022-01-16 17:56:07 -05:00
Sylvestre Ledru
516bdfcfd5
Merge pull request #2872 from jfinkels/split-verbose
split: add --verbose option
2022-01-16 23:19:30 +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
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
e3b8e6c993 who: 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
b43839a8a8 sort: 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
283973c5bf rm: 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
6e39eddbc1 mknod: 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
89112fb1c2 install: clap 3 2022-01-11 19:16:47 +01:00
Sylvestre Ledru
6723a54610
Merge pull request #2862 from rivy/fix.whitespace
refactor/polish ~ whitespace fixup
2022-01-11 17:51:37 +01:00
kimono-koans
016d5e72ad
ls: Fix padding for dangling links in non-Long formats (#2856)
* Fix padding for dangling links in non-long formats

Co-authored-by: electricboogie <32370782+electricboogie@users.noreply.github.com>
2022-01-11 12:01:54 +01:00
Jeffrey Finkelstein
cfe5a0d82c split: correct filename creation algorithm
Fix two issues with the filename creation algorithm. First, this
corrects the behavior of the `-a` option. This commit ensures a
failure occurs when the number of chunks exceeds the number of
filenames representable with the specified fixed width:

    $ printf "%0.sa" {1..11} | split -d -b 1 -a 1
    split: output file suffixes exhausted

Second, this corrects the behavior of the default behavior when `-a`
is not specified on the command line. Previously, it was always
settings the filenames to have length 2 suffixes. This commit corrects
the behavior to follow the algorithm implied by GNU split, where the
filename lengths grow dynamically by two characters once the number of
chunks grows sufficiently large:

    $ printf "%0.sa" {1..91} | ./target/debug/coreutils split -d -b 1 \
    >   && ls x* | tail
    x81
    x82
    x83
    x84
    x85
    x86
    x87
    x88
    x89
    x9000
2022-01-10 20:43:22 -05:00
Terts Diepraam
f60c36f242
Merge pull request #2610 from miDeb/cp/abuse
cp: handle edge cases when dest is a symlink
2022-01-11 00:34:55 +01:00
Roy Ivy III
7a760cae99 refactor/polish ~ re-normalize whitespace
* minimize inconsistent/invisible whitespace

- consistent indentation (either spaces-only, tabs, *or* tabs with following spaces [for indentation])
- no internal/invisible tabs
- no trailing whitespace
- EOF EOLNs
2022-01-09 21:35:39 -06:00