Commit graph

2405 commits

Author SHA1 Message Date
Jeffrey Finkelstein
042e537ca8 df: refactor is_included(), mount_info_lt() funcs
Factor two helper functions, `is_included()` and `mount_info_lt()`,
from the `filter_mount_list()` function.
2022-02-12 21:06:37 -05:00
Jeffrey Finkelstein
b13718e742 head: use Self instead of enum name Mode in method 2022-02-12 14:45:45 -05:00
Sylvestre Ledru
f9e04ae5ef
Merge pull request #2966 from allan-silva/wc-files0-from-opt
wc: implement files0-from option
2022-02-12 19:05:05 +01:00
Sylvestre Ledru
0ed5e2c884
Merge pull request #2957 from jfinkels/head-preserve-no-final-newline
head: don't add trailing newline to end of file that didn't originally have one
2022-02-12 19:03:13 +01:00
Sylvestre Ledru
0f17ef2028
Merge pull request #2906 from jfinkels/head-better-mode
head: incorporate "all but last" option into Mode
2022-02-12 19:01:49 +01:00
Sylvestre Ledru
142c24e579
Merge pull request #2982 from Dr-Emann/paste_cleanup
paste: Fixes and cleanup
2022-02-12 19:00:39 +01:00
Sylvestre Ledru
c67a64c9df
Merge pull request #3121 from serhansekman/pr-help-page
pr: add missing about and version to documentation
2022-02-12 18:13:31 +01:00
alextibbles
d9c2acc2ed
update to sha 0.10.0 (#3110)
* update to sha 0.10.0

* correct formatting
2022-02-12 18:12:02 +01:00
Hanif Ariffin
45a1b7e4bb
ls: refactor out padding calculations (#3072)
* Refactor padding calculations into a function

* Propagate all write and (most) flush errors
2022-02-12 11:39:17 +01:00
Sylvestre Ledru
c2e3f4109c
Merge pull request #2944 from jfinkels/truncate-fifo
truncate: error when trying to truncate a fifo
2022-02-12 11:36:17 +01:00
Sylvestre Ledru
52282740dd
Merge pull request #3078 from ndd7xv/dd-progress-fix
dd: make status=progress rewrite once/sec
2022-02-12 11:34:21 +01:00
Sylvestre Ledru
090fb07361
Merge pull request #3066 from jfinkels/dd-skip-beyond-file
dd: show warning if skipping past end of input
2022-02-12 11:34:06 +01:00
Sylvestre Ledru
6b6d5ee7db
Merge pull request #2827 from jfinkels/split-std-io-copy
split: use std::io::copy() with new writer implementation to improve maintainability and speed
2022-02-12 11:33:12 +01:00
Sylvestre Ledru
e76818bb19
Merge pull request #3083 from jfinkels/df-table-module
df: refactor data table into Row, Header structs
2022-02-12 11:30:28 +01:00
Sylvestre Ledru
463e160d2f
Merge pull request #3117 from jfinkels/touch-no-deref-no-file
touch: show error on -h with nonexistent file
2022-02-12 11:27:46 +01:00
Tevfik Serhan Sekman
ad1954bd16 pr: add missing about and version to documentation 2022-02-12 12:36:28 +03:00
Jeffrey Finkelstein
f37e78c25a touch: show error on -h with nonexistent file
Show an error message when running `touch -h` on a nonexistent file.
2022-02-11 20:58:16 -05:00
Sylvestre Ledru
080cb2b6f9
Merge pull request #3108 from DestroyerXyz/blake3
hashsum: Add BLAKE3 to Hashing Algorithms
2022-02-11 11:40:10 +01:00
Jeffrey Finkelstein
2f65b29866 split: error when --additional-suffix contains /
Make `split` terminate with a usage error when the
`--additional-suffix` argument contains a directory separator
character.
2022-02-10 19:33:33 -05:00
Sylvestre Ledru
e818fd2b98
Merge pull request #3092 from jtracey/join-performance
join: improve performance
2022-02-10 22:39:12 +01:00
Abhishek C Sharma
3f6fe7f388
ls: add new optional arguments to --classify flag (#3041)
* ls: add new optional arguments to --classify flag

The --classify flag in ls now takes an option when argument
that may have the values always, auto and none.

Modified clap argument to allow an optional parameter and
changed the classify flag value parsing logic to account for
this change.

* ls: add test for indicator-style, ind and classify with value none

* ls: require option paramter to --classify to use a = to specify flag value

* ls: account for all the undocumented possible values for the --classify flag

Added the other values for the --classify flag along with modifications to tests.
Also documented the inconsistency between GNU coreutils because we accept the
flag value even for the short version of the flag.
2022-02-10 21:35:20 +01:00
Shreyans Jain
30d7a4b167
hashsum: Add BLAKE3 to Hashing Algorithms
Signed-off-by: Shreyans Jain <shreyansthebest2007@gmail.com>
2022-02-10 12:46:44 +05:30
Sylvestre Ledru
e5be9c1aaf
Merge pull request #3099 from tertsdiepraam/shuf-refactor
`shuf`: remove custom logic for bounded randomization
2022-02-09 07:37:22 +01:00
Jeffrey Finkelstein
b37718de10 split: add BENCHMARKING.md documentation file 2022-02-08 22:58:00 -05:00
Jeffrey Finkelstein
70ca1f45ea split: remove unused ByteSplitter and LineSplitter 2022-02-08 22:58:00 -05:00
Jeffrey Finkelstein
1d7e1b8732 split: use ByteChunkWriter and LineChunkWriter
Replace `ByteSplitter` and `LineSplitter` with `ByteChunkWriter` and
`LineChunkWriter` respectively. This results in a more maintainable
design and an increase in the speed of splitting by lines.
2022-02-08 22:57:57 -05:00
Jeffrey Finkelstein
b31d63eaa9 split: add ByteChunkWriter and LineChunkWriter
Add the `ByteChunkWriter` and `LineChunkWriter` structs and
implementations, but don't use them yet. This structs offer an
alternative approach to writing chunks of output (contrasted with
`ByteSplitter` and `LineSplitter`). The main difference is that
control of which underlying file is being written is inside the writer
instead of outside.
2022-02-08 22:53:56 -05:00
Terts Diepraam
dc24c9563e shuf: BENCHMARKING.md 2022-02-08 21:05:39 +01:00
Sylvestre Ledru
47b12b31a6
Merge pull request #3006 from jfinkels/split-errors
split: correct error message on invalid arg. to -a
2022-02-08 20:51:32 +01:00
Sylvestre Ledru
daaae90113
Merge branch 'main' into dd-skip-beyond-file 2022-02-08 20:46:07 +01:00
Sylvestre Ledru
936ac0db38
Merge pull request #3053 from snobee/stat-handle-negative-time
stat: allow formatting of negative numbers
2022-02-08 20:45:21 +01:00
Sylvestre Ledru
12d5139320
Merge pull request #3095 from jfinkels/dd-concise-main-loop
dd: make main loop more concise
2022-02-08 20:44:39 +01:00
Terts Diepraam
9538814702 shuf: use split_once for parsing the range 2022-02-08 14:39:32 +01:00
Terts Diepraam
30ae952b83 shuf: remove custom randomization logic 2022-02-08 14:39:32 +01:00
Sylvestre Ledru
9c813be5f1
Merge pull request #3076 from jfinkels/dd-seek-truncate
dd: truncate to specified seek length
2022-02-08 11:16:15 +01:00
Justin Tracey
b873d46ca0 join: flush stdout before final error message 2022-02-07 22:32:02 -05:00
Jeffrey Finkelstein
c002b16c67 dd: make main loop more concise
Add some helper functions and adjust some error-handling to make the
`Output::dd_out()` method, containing the main loop of the `dd`
program, more concise. This commit also adds documentation and
comments describing the main loop procedure in more detail.
2022-02-07 10:00:49 -05:00
Allan Silva
e6c94c1cd7 wc: Fix clippy error 2022-02-07 10:20:52 -03:00
Sylvestre Ledru
b14e396983
Merge pull request #3091 from jfinkels/df-flatten-filter-mount-list
df: refactor filter_mount_list() to be more flat
2022-02-07 10:59:23 +01:00
Justin Tracey
41c90d79c4 join: add benchmarking documentation 2022-02-06 23:53:03 -05:00
Justin Tracey
ac9d006886 join: guess the number of fields in each line
This lets us use fewer reallocations when parsing each line.
The current guess is set to the maximum fields in a line so far. This is
a free performance win in the common case where each line has the same
number of fields, but comes with some memory overhead in the case where
there is a line with lots of fields at the beginning of the file, and
fewer later, but each of these lines are typically not kept for very
long anyway.
2022-02-06 23:37:17 -05:00
Justin Tracey
f33e058a5a join: faster field parsing and representation
Using indexes into the line instead of Vec<u8>s means we don't have to copy
the line to store the fields (indexes instead of slices because it avoids
self-referential structs). Using memchr also empirically saves a lot of
intermediate allocations.
2022-02-06 23:37:17 -05:00
Justin Tracey
e6f59b12f7 join: lock and buffer stdout
By abstracting the writer we write to, we can lock stdout once at the
beginning, then use buffered writes to it throughout.
2022-02-06 23:37:17 -05:00
Justin Tracey
c12f393150 join: improve error handling 2022-02-06 23:37:06 -05:00
Jeffrey Finkelstein
9528d514bf df: refactor data table into Row, Header structs
Refactor the code for representing the `df` data table into `Header`
and `Row` structs. These structs live in a new module `table.rs`. When
combined with the `Options` struct, these structs can be
`Display`ed. Organizing the code this way makes it possible to test
the display settings independently of the machinery for getting the
filesystem data. New unit tests have been added to `table.rs` to
demonstrate this benefit.
2022-02-06 21:54:58 -05:00
Jeffrey Finkelstein
9f8ec676c5 dd: show warning if skipping past end of input
Show a warning if the `skip=N` command-line argument would cause `dd`
to skip past the end of the input. For example:

    $ printf "abcd" | dd bs=1 skip=5 count=0 status=noxfer
    'standard input': cannot skip to specified offset
    0+0 records in
    0+0 records out
2022-02-06 20:10:42 -05:00
Jeffrey Finkelstein
84d4f24b8c dd: avoid infinite loop in Input::force_fill()
Avoid an infinite loop in `Input::force_fill()` when the input has
fewer bytes than are being requested to be read from the input.
2022-02-06 20:10:41 -05:00
Jeffrey Finkelstein
8fa6797255 split: add structure to errors that can be created
Add some structure to errors that can be created during parsing of
settings from command-line options. This commit creates
`StrategyError` and `SettingsError` enumerations to represent the
various parsing and other errors that can arise when transforming
`ArgMatches` into `Settings`.
2022-02-06 20:09:29 -05:00
Jeffrey Finkelstein
e5361a8c11 split: correct error message on invalid arg. to -a
Correct the error message displayed on an invalid parameter to the
`--suffix-length` or `-a` command-line option.
2022-02-06 20:09:29 -05:00
Jeffrey Finkelstein
572b2e032c df: refactor filter_mount_list() to be more flat
Use a `for` loop in the `filter_mount_list()` function to make the
filtering logic easier to read.
2022-02-06 20:04:03 -05:00