Commit Graph

4541 Commits

Author SHA1 Message Date
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
Jan Scheer 12a43d6eb3 date: fix format literal for nanoseconds 2021-05-12 10:21:24 +02:00
Sylvestre Ledru a5f8ca60b5 Merge pull request #2199 from jhscheer/refactor_fsext
df/stat: refactor - reduce duplicate code
2021-05-12 08:41:16 +02:00
Sylvestre Ledru 6635301f32 Merge pull request #2194 from miDeb/sort-stable-merge
sort: make merging stable
2021-05-12 08:38:48 +02:00
Sylvestre Ledru 57ae202037 Merge pull request #2195 from nthery/wc_dash
wc: emit '-' in ouput when set on command-line
2021-05-12 08:37:55 +02:00
Sylvestre Ledru 8f24ec9414 Merge pull request #2198 from jfinkels/tail-refactor
tail: simplify unbounded_tail() function
2021-05-12 08:35:45 +02:00
Sylvestre Ledru 68a3488cdc Merge pull request #2202 from drocco007/test-negated-boolean
test: improve handling of inverted Boolean expressions
2021-05-12 08:34:41 +02:00
Sylvestre Ledru e16df57206 Merge pull request #2205 from jhscheer/issue_2204
date: fix format for nanoseconds
2021-05-11 23:44:29 +02:00
Jan Scheer 8200d399e8 date: fix format for nanoseconds 2021-05-11 23:03:59 +02:00
Sylvestre Ledru 019f1b1a88 Merge pull request #2203 from sylvestre/travis
Remove travis CI
2021-05-11 20:01:59 +02:00
Sylvestre Ledru b9d44facb9 refresh cargo.lock with recent updates 2021-05-11 10:27:13 +02:00