Commit graph

6990 commits

Author SHA1 Message Date
Jeffrey Finkelstein
44772a8dbb uucore: set meaningless FsUsage.ffree value to 0
Set the value of the `FsUsage.ffree` value to 0 on Windows, because
even though it is meaningless, it should not exceed the
`FsUsage.files` value so that client code can rely on the guarantee
that `FsUsage.ffree <= FsUsage.files`.
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
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
ndd7xv
3842ecb1b4 dd: status=progress rewrites once/sec 2022-02-06 17:56:08 -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
Sylvestre Ledru
f27f827751
Merge pull request #3077 from rivy/fix.gnutests
maint/CICD ~ implement 'GnuTests' workflow fixes/refactor
2022-02-06 15:34:03 +01:00
Hanif Bin Ariffin
9ce9a44052 Silencing clippy about unused variables
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.43262@gmail.com>
2022-02-06 10:26:01 +08:00
Hanif Bin Ariffin
ff1d1c3b19 Merge branch 'main' of github.com:uutils/coreutils into hbina-ls-propagate-write-errors 2022-02-06 10:25:17 +08:00
Sylvestre Ledru
57cf3a533f
Merge pull request #3067 from ndd7xv/printf-clap-defaults
printf: use clap default help and version
2022-02-05 22:16:44 +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
Roy Ivy III
578e5c8aba maint/CICD ~ implement 'GnuTests' workflow fixes/refactor
- consolidate configuration
- DRY improvements
- improve flexibility/robustness in the face of missing reference test info
- add reference test info IDs and additional logging to help diagnose testing failures
- includes parallel refactor of 'util/run-gnu-test.sh'
2022-02-05 14:21:15 -06:00
Roy Ivy III
cc61ea807e docs/CICD ~ add spell-checker exceptions 2022-02-05 14:21:15 -06: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
Hanif Ariffin
78847e2ad0 Undo a small change that was meant to silence clippy
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-05 23:40:23 +08:00
Hanif Ariffin
519e82240a Revert "Refactor padding calculations into a function"
This reverts commit f39b861469.

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-05 23:32:44 +08:00
Sylvestre Ledru
ebf33d775e
Merge pull request #3023 from RishiKumarRay/main
basenc, base64 and base32 have an ABOUT that's formatted differently than the other utils
2022-02-05 14:40:03 +01:00
Hanif Ariffin
e35b93156a Propagate all write and (most) flush errors
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-05 19:30:39 +08:00
Hanif Ariffin
f39b861469 Refactor padding calculations into a function
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-05 19:12:05 +08: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
ndd7xv
5e790918ef printf: use clap default help and version 2022-02-04 22:07:31 -05:00
Sylvestre Ledru
af8bcd8d52
Merge pull request #3063 from rivy/feat.cicd
feat/CICD ~ add check for correct clippy MSRV configuration
2022-02-05 00:16:09 +01:00
Sylvestre Ledru
3a9be54815
Merge pull request #3013 from slycordinator/shellcheck
Shell script cleanup
2022-02-05 00:01:03 +01:00
Sylvestre Ledru
13dbb2ce12
Merge pull request #3060 from hbina/hbina-add-test-for-additional-escape
test_printf: add test for additional escape (\c)
2022-02-04 21:44:08 +01: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
572a505119
Merge pull request #3024 from ndd7xv/printf-version-documentation
printf: add description and version
2022-02-04 10:45:28 +01:00
Sylvestre Ledru
03b53a89c9
Merge pull request #3019 from Toxaris/gitattributes
Allow comments in VS Code configuration
2022-02-04 10:31:37 +01: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
Guilherme Augusto de Souza
ae755bb9bd
test: add version and about (#3011) 2022-02-04 10:28:15 +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
Sylvestre Ledru
edce04e8ee
Merge pull request #3059 from jfinkels/df-options-parsing
df: create Options::from() function to contain the code for parsing ArgMatches
2022-02-04 08:22:11 +01:00
Jeffrey Finkelstein
639971e520 df: refactor function for parsing CLI args
Add a `Options::from()` function to collect the code for parsing an
`Options` object from the `clap::ArgMatches` object.
2022-02-03 23:19:14 -05: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
Roy Ivy III
f01c3ef46a maint/polish ~ whitespace normalization 2022-02-03 15:00:05 -06:00
Roy Ivy III
caad4db712 maint/CICD ~ add MSRV check for '.clippy.toml' 2022-02-03 15:00:05 -06: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 Ariffin
861437addf Fix small clippy issue
Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-03 21:45:02 +08: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 Ariffin
ff8a83b256 touch: Better error message when no args is given
Matches the behavior of GNU touch

```shell
hbina@akarin ~/g/uutils (hbina-realpath-absolute-symlinks)> touch > /dev/null
touch: missing file operand
Try 'touch --help' for more information.
hbina@akarin ~/g/uutils (hbina-realpath-absolute-symlinks) [1]> cargo run --quiet -- touch > /dev/null
touch: missing file operand
Try 'touch --help' for more information.
hbina@akarin ~/g/uutils (hbina-realpath-absolute-symlinks) [1]> cargo run --quiet -- touch 2> /dev/null
hbina@akarin ~/g/uutils (hbina-realpath-absolute-symlinks) [1]> touch 2> /dev/null
```

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
2022-02-03 21:10:39 +08:00