Commit graph

4556 commits

Author SHA1 Message Date
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
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
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
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
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
Sylvestre Ledru
6aee792a93 Remove travis CI
* it is redundant with github action
* less integrated
* fails someone for some unexpected reasons
* it is blocking code coverage results ?!
2021-05-11 09:30:46 +02:00
Daniel Rocco
2ec4bee350 test: improve handling of inverted Boolean expressions
- add `==` as undocumented alias of `=`

- handle negated comparison of `=` as literal

- negation generally applies to only the first expression of a Boolean chain,
  except when combining evaluation of two literal strings
2021-05-10 22:48:40 -04:00
Jan Scheer
381f8dafc6 df/uucore: refactor - move duplicate code to uucore/fsext.rs 2021-05-10 23:37:01 +02:00
Sylvestre Ledru
ed42652803
Merge pull request #2200 from jhscheer/fix_clippy
fix clippy warnings
2021-05-10 16:13:27 +02:00
Jan Scheer
4ac75898c3 fix clippy warnings 2021-05-10 15:48:32 +02:00
Sylvestre Ledru
adf12ee927
Merge pull request #2197 from Gilnaa/2125-arch-clap
Switched 'arch' to use clap instead of getopts
2021-05-10 15:06:46 +02:00
Jan Scheer
203ee463c7 stat/uucore: refactor - move fsext.rs to uucore 2021-05-10 10:46:00 +02:00
Sylvestre Ledru
f7ad47d7e4
Merge pull request #2196 from uutils/sylvestre-patch-6
Ignore test_domain_socket  as it fails too often
2021-05-10 09:00:19 +02:00
Sylvestre Ledru
881bbf512e refresh cargo.lock with recent updates 2021-05-10 08:59:45 +02:00
Jeffrey Finkelstein
0cc779c733 tail: simplify unbounded_tail() function
Refactor common code out of two branches of the `unbounded_tail()`
function into a new `unbounded_tail_collect()` helper function, that
collects from an iterator into a `VecDeque` and keeps either the last
`n` elements or all but the first `n` elements.

This commit also adds a new struct, `RingBuffer`, in a new module,
`ringbuffer.rs`, to be responsible for keeping the last `n` elements
of an iterator.
2021-05-09 23:47:13 -04:00