Commit graph

1573 commits

Author SHA1 Message Date
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
142c24e579
Merge pull request #2982 from Dr-Emann/paste_cleanup
paste: Fixes and cleanup
2022-02-12 19:00:39 +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
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
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
cccc6b8524
Merge pull request #3089 from jfinkels/tests-stderr-only-bytes
tests: fix no_stderr check in stderr_only_bytes()
2022-02-12 11:32:35 +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
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
353fc443
c2bb9dd433
Fix clippy octal-escapes warning 2022-02-11 13:02:06 +00: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
3176ad5c1b
tests/hashsum: Fix missing space in checkfile 2022-02-10 13:55:53 +05:30
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
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
ca7af808d5 tests: correct a test case for split
Correct the `test_split::test_suffixes_exhausted` test case so that it
actually exercises the intended behavior of `split`. Previously, the
test fixture contained 26 bytes. After this commit, the test fixture
contains 27 bytes. When using a suffix width of one, only 26 filenames
should be available when naming chunk files---one for each lowercase
ASCII letter. This commit ensures that the filenames will be exhausted
as intended by the test.
2022-02-08 22:53:57 -05: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
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
Justin Tracey
bf67c5d981 join: add tests for --check-order and stdout error 2022-02-07 22:26:27 -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
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
e6a63a78f6 tests: fix no_stderr check in stderr_only_bytes()
Fix a bug in `stderr_only_bytes()` where it was unintentionally
checking `no_stderr()` when it should have been checking
`no_stdout()`.
2022-02-06 18:03:13 -05:00
Jeffrey Finkelstein
fec662a623 dd: show warning when using 0x size multiplier
Show a warning when a block size includes "0x" since this is
ambiguous: the user may have meant "multiply the next number by zero"
or they may have meant "the following characters should be interpreted
as a hexadecimal number".
2022-02-06 17:13:15 -05:00
Sylvestre Ledru
1f7c08d87b
Merge pull request #3028 from jfinkels/dd-multipliers
dd: add support for 'b' and 'x' multipliers in numeric arguments
2022-02-06 22:03:54 +01:00
Sylvestre Ledru
16b397a648
Merge pull request #3029 from hbina/hbina-test_ls_order_time-is-flaky
test_ls: Do not rely on the system time of metadata'access time
2022-02-06 22:03:31 +01:00
Sylvestre Ledru
1ac45c9961
Merge pull request #3044 from water-ghosts/cp-dir-vs-file
cp: Fail when copying a directory to a file
2022-02-06 22:01:37 +01:00
Jeffrey Finkelstein
1af709f642 dd: truncate to specified seek length
When specifying `seek=N` and *not* specifying `conv=notrunc`, truncate
the output file to `N` blocks instead of truncating it to zero before
starting to write output. For example

    $ printf "abc" > outfile
    $ printf "123" | dd bs=1 skip=1 seek=1 count=1 status=noxfer of=outfile
    1+0 records in
    1+0 records out
    $ cat outfile
    a2

Fixes #3068.
2022-02-05 16:07:44 -05:00
Sylvestre Ledru
2ffc5f9e13
Merge pull request #3070 from water-ghosts/printf-0
printf: Support leading zeroes with %0n formatting
2022-02-05 21:02:16 +01:00
Sylvestre Ledru
252e30c839
Merge pull request #3046 from hbina/hbina-tail-head-dont-use-is-numeric-to-check-digits
tail&head: dont use is_numeric to check for digits
2022-02-05 10:08:01 +01:00
Eli Youngs
162f85773e printf: Support leading zeroes with %0n formatting 2022-02-05 00:43:09 -08:00
Allan Silva
6a6875012e wc: implement files0-from option
When this option is present, the files argument is not processed. This option processes the file list from provided file, splitting them by the ascii NUL (\0) character. When files0-from is '-', the file list is processed from stdin.
2022-02-04 10:12:08 -03:00
Hanif Ariffin
793d3dd97c test_printf: add test for additional escape (\c)
Using this escaped character will cause `printf` to stop generating characters.

For instance,

```rust
hbina@akarin ~/g/uutils (hbina-add-test-for-additional-escape)> cargo run --quiet -- printf "%s\c%s" a b
a⏎
```

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-04 18:47:23 +08:00
Sylvestre Ledru
b4c85b2c17
Merge pull request #2997 from tertsdiepraam/cp-allow-hyphen-suffix
`uucore`: allow backup suffix with hyphen value
2022-02-04 10:29:21 +01:00
Sylvestre Ledru
033fd62f6a
Merge pull request #3047 from hbina/hbina-touch-better-msg-when-no-args
touch: Better error messages when no args is provided
2022-02-04 10:27:01 +01:00
Jeffrey Finkelstein
3fbaa79359 dd: add support for 'b' and 'x' multipliers
Support the suffix 'b' (multiply by 512) and 'x' (multiply by an
arbitrary amount) when specifying numeric arguments to dd.
2022-02-03 21:56:13 -05:00
snobee
f7e31f6008 stat: allow formatting of negative numbers 2022-02-03 16:01:19 -08:00
Hanif Ariffin
e60b581c38
test_sort: Preserve the environment variable when executing tests (#3031)
* test_sort: Output sorted files to a file with different name

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>

* Fix the test by saving the environment variable

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>

Co-authored-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>
2022-02-03 16:02:50 +01:00
Hanif Bin Ariffin
3586465917 dont use is_numeric to check for digits
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>
2022-02-03 21:42:22 +08:00
snobee
ee721ebf4e head: handle multibyte numeric utf-8 chars 2022-02-03 21:42:22 +08:00
Hanif Ariffin
9cd65c766a Add tests
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-03 21:14:56 +08:00
Hanif Bin Ariffin
c4c666814b Merge branch 'main' of github.com:uutils/coreutils into hbina-test_ls_order_time-is-flaky 2022-02-03 19:57:13 +08:00
Sylvestre Ledru
2d3b8db9ed
Merge pull request #3012 from shoriminimoe/2951-truncate
truncate: change cli error return code
2022-02-03 10:43:16 +01:00
Eli Youngs
d50c9c3e77 Fail when copying a directory to a file 2022-02-02 23:59:32 -08:00
Sylvestre Ledru
b411d91fac
Merge pull request #3014 from HeroicKatora/main
Make true return false less frequently
2022-02-02 21:43:21 +01:00