Commit graph

4576 commits

Author SHA1 Message Date
Sylvestre Ledru
ddcd6be37a gnu: document how to run the tests 2021-05-22 09:33:17 +02:00
Sylvestre Ledru
adaba54026 gnu/ci: move the operations into script to run them locally 2021-05-22 09:33:15 +02:00
Sylvestre Ledru
73b47b8c76 gnu/ci: install the dep into a separate task 2021-05-21 18:33:05 +02:00
Sylvestre Ledru
df45b20dc1
Merge pull request #2243 from jfinkels/truncate-min-max
truncate: use min() and max() instead of if/else statements
2021-05-21 10:09:43 +02:00
Sylvestre Ledru
76844dbd56
Merge pull request #2241 from jfinkels/truncate-rustfmt-test
truncate: rustfmt test_truncate.rs file
2021-05-21 10:06:45 +02:00
Sylvestre Ledru
d00dabca1c
Merge pull request #2242 from jfinkels/truncate-file-not-found-error
truncate: fix error message for file not found
2021-05-21 10:06:01 +02:00
Jeffrey Finkelstein
17b95246cd truncate: use min() and max() instead of if stmts 2021-05-20 21:24:43 -04:00
Jeffrey Finkelstein
fc29846b45 truncate: fix error message for file not found
Change the error message for when the reference file (the `-r` argument)
is not found to match GNU coreutils. This commit also eliminates a
redundant call to `File::open`; the file need not be opened because the
size in bytes can be read from the result of `std::fs::metadata()`.
2021-05-20 20:59:59 -04:00
Jeffrey Finkelstein
d30393089f truncate: rustfmt test_truncate.rs file 2021-05-20 20:58:56 -04:00
Sylvestre Ledru
b9e99543db
Merge pull request #2234 from chadbrewbaker/fix-cat-random-timeout
dev random blocks on linux
2021-05-20 23:25:11 +02:00
Sylvestre Ledru
efb781f59a
Merge pull request #2221 from jfinkels/head-display-multiple-errors-2
head: display errors for each input file instead of terminating at the first error
2021-05-20 23:24:35 +02:00
Sylvestre Ledru
ca196a6dad
Merge pull request #2218 from miDeb/sort-chunks
sort: read files as chunks, off-thread
2021-05-20 23:24:02 +02:00
Sylvestre Ledru
52a7e07b3e
Merge pull request #2226 from nbraud/pin-GNU-tests
CI: Stabilise the version of GNU tests used in CI
2021-05-20 16:30:32 +02:00
Sylvestre Ledru
743db76056
Merge pull request #2238 from jfinkels/truncate-refactor-parse-size
truncate: simplify parse_size() function and correct error message
2021-05-20 08:21:19 +02:00
Jeffrey Finkelstein
63b496eaa8 truncate: refactor parse_size() function
Change the interface provided by the `parse_size()` function to reduce
its responsibilities to just a single task: parsing a number of bytes
from a string of the form '123KB', etc. Previously, the function was
also responsible for deciding which mode truncate would operate in.

Furthermore, this commit simplifies the code for parsing the number and
unit to be less verbose and use less mutable state.

Finally, this commit adds some unit tests for the `parse_size()`
function.
2021-05-19 23:07:11 -04:00
Sylvestre Ledru
0c6a848314
gnu results: also add the date (#2236) 2021-05-19 20:33:28 +02:00
Sylvestre Ledru
34d13324bf
Merge pull request #2233 from sylvestre/gnu
publish the results of the gnu testsuite as a json file too
2021-05-19 11:07:54 +02:00
Chad Brewbaker
9167a4128d
Update test_cat.rs
Refactored to constants
2021-05-19 04:06:46 -05:00
Sylvestre Ledru
ddf3c9cfcf
Merge pull request #2235 from jhscheer/fix_clippy_warnings
fix clippy warnings
2021-05-19 09:36:05 +02:00
Jan Scheer
8032c6d750 fix clippy warnings 2021-05-19 01:37:28 +02:00
Sylvestre Ledru
7bf342fa52 publish the results of the gnu testsuite as a json file too 2021-05-18 23:05:49 +02:00
Chad Brewbaker
a69cb11de9 Removing debug code 2021-05-18 15:17:07 -05:00
Chad Brewbaker
c60d3866c3 dev random blocks on linux 2021-05-18 15:10:51 -05:00
Sylvestre Ledru
cacd078a49
Merge pull request #2227 from jfinkels/tail-iocopy-bounded-tail
tail: use std::io::copy() to write bytes to stdout
2021-05-18 20:42:59 +02:00
Sylvestre Ledru
de5c1d90db
Merge pull request #2232 from jhscheer/stat_test_refactor
stat: remove unused/duplicate tests
2021-05-18 20:42:33 +02:00
Jan Scheer
ce5b852a31 stat: remove unused/duplicate tests 2021-05-18 19:58:33 +02:00
Sylvestre Ledru
3977eb8934
Merge pull request #2229 from jhscheer/issue_2223
tests: add test for issue #2223
2021-05-18 11:32:57 +02:00
Jan Scheer
7c7d622d54 tests: add test for issue #2223 2021-05-18 02:00:16 +02:00
Jeffrey Finkelstein
fea1026669 tail: use std::io::copy() to write bytes to stdout 2021-05-17 18:15:39 -04:00
Sylvestre Ledru
dc02c36a6a
Merge pull request #2225 from sylvestre/gnu
gh action: fix the GNU testsuite job
2021-05-17 22:51:06 +02:00
Sylvestre Ledru
047d775e5e gh action: fix the GNU testsuite job 2021-05-17 21:24:58 +02:00
nicoo
f46b119493 CI: Stabilise the version of GNU tests used in CI
The “GNU tests” task is routinely broken on `master`.
Broken CI is worse than no CI, as it teaches people to ignore errors.

This PR pins the versions of the GNU testsuite (and GNUlib) used,
to current stable versions, so this task stops breaking unexpectedly.

Presumably, someone will update `GNU.yml` when a new stable version
of the GNU coreutils is released, but I'm not volunteering.
2021-05-17 21:07:05 +02:00
Jeffrey Finkelstein
eeef8290df head: display errors for each input file
Change the behavior of `head` to display an error for each problematic
file, instead of displaying an error message for the first problematic
file and terminating immediately at that point. This change now matches
the behavior of GNU `head`.

Before this commit, the first error caused the program to terminate
immediately:

    $ head a b c
    head: error: head: cannot open 'a' for reading: No such file or directory

After this commit:

    $ head a b c
    head: cannot open 'a' for reading: No such file or directory
    head: cannot open 'b' for reading: No such file or directory
    head: cannot open 'c' for reading: No such file or directory
2021-05-17 08:19:47 -04:00
Sylvestre Ledru
6c830e2f25
Merge pull request #2220 from chadbrewbaker/fix-ls-test-regex
fixing regex to take negative time offsets
2021-05-17 08:17:19 +02:00
Chad Brewbaker
2f84f59573 fixing regex to take negative time offsets 2021-05-16 19:43:53 -05:00
Michael Debertol
fcd48813e0 sort: read files as chunks, off-thread
Instead of using a BufReader and reading each line separately,
allocating a String for each one, we read to a chunk. Lines are
references to this chunk. This makes the allocator's job much easier
and yields performance improvements.

Chunks are read on a separate thread to further improve performance.
2021-05-16 21:13:37 +02:00
Sylvestre Ledru
9e2c82d8e7
Merge pull request #2217 from jfinkels/head-multiple-files
head: print headings when reading multiple files
2021-05-16 18:28:31 +02:00
Jeffrey Finkelstein
659bf58a4c head: print headings when reading multiple files
Fix a bug in which `head` failed to print headings for `stdin` inputs
when reading from multiple files, and fix another bug in which `head`
failed to print a blank line between the contents of a file and the
heading for the next file when reading multiple files. The output now
matches that of GNU `head`.
2021-05-16 12:03:10 -04:00
Sylvestre Ledru
7d2b6409e2
Merge pull request #2216 from jfinkels/head-refactor-rbuf-n-bytes
head: simplify rbuf_n_bytes() in head.rs
2021-05-16 12:25:53 +02:00
Jeffrey Finkelstein
733d347fa8 head: simplify rbuf_n_bytes() in head.rs
Simplify the code in `rbuf_n_bytes()` to use existing abstractions
provided by the standard library.
2021-05-15 23:04:01 -04:00
Sylvestre Ledru
620a5a5df6
Merge pull request #2210 from jhscheer/dns_lookup
who: fix `--lookup`
2021-05-15 21:18:12 +02:00
Sylvestre Ledru
46cf61b5b7
Merge pull request #2212 from jfinkels/2211-wc-error-messages
wc: correct some error messages for invalid inputs
2021-05-15 21:14:15 +02:00
Jeffrey Finkelstein
e8d911d9d5 wc: correct some error messages for invalid inputs
Change the error messages that get printed to `stderr` for compatibility
with GNU `wc` when an input is a directory and when an input does not
exist.

Fixes #2211.
2021-05-15 10:35:21 -04:00
Jan Scheer
a4fc2b5106 who: fix --lookup
This closes #2181.

`who --lookup` is failing with a runtime panic (double free).
Since `crate::dns-lookup` already includes a safe wrapper for `getaddrinfo`
I used this crate instead of further debugging the existing code in
utmpx::canon_host().

* It was neccessary to remove the version constraint for libc in uucore.
2021-05-13 22:16:15 +02:00
Sylvestre Ledru
204b051711
Merge pull request #2206 from jfinkels/tail-reverse-block-iterator
tail: refactor code into ReverseChunks iterator
2021-05-13 09:07:02 +02:00
Jeffrey Finkelstein
2e621759b2 tail: refactor code into ReverseChunks iterator
Refactor code from the `backwards_thru_file()` function into a new
`ReverseChunks` iterator, and use that iterator to simplify the
implementation of the `backwards_thru_file()` function. The
`ReverseChunks` iterator yields `Vec<u8>` objects, each of which
references bytes of a given file.
2021-05-12 18:43:58 -04:00
Jeffrey Finkelstein
3114fd77be tail: use &mut File instead of mut file: &File 2021-05-12 18:43:35 -04:00
Sylvestre Ledru
190a936a23
Merge pull request #2208 from sylvestre/update-cargo-lock2
refresh cargo.lock with recent updates
2021-05-12 23:32:15 +02:00
Sylvestre Ledru
0669c89ef3 refresh cargo.lock with recent updates 2021-05-12 14:47:45 +02:00
Sylvestre Ledru
2178edf628
Merge pull request #2207 from jhscheer/issue_2204
date: fix format literal for nanoseconds
2021-05-12 13:14:23 +02:00