Commit graph

7312 commits

Author SHA1 Message Date
Sylvestre Ledru
1e6b248a77
Merge pull request #3304 from ackerleytng/main
wc: compute number widths using total file sizes
2022-03-30 09:52:21 +02:00
Sylvestre Ledru
b55af14666
Merge pull request #3335 from sylvestre/usage
gnu/usage_vs_getopts.sh: make the test FAIL instead of ERROR
2022-03-30 09:30:18 +02:00
Sylvestre Ledru
a13f0c8fe0 gnu/usage_vs_getopts.sh: default the usage error value to 2 in the GNU test
Closes issue #3331
2022-03-29 22:33:18 +02:00
Sylvestre Ledru
981a77d0cd gnu/usage_vs_getopts.sh: make the test FAIL instead of ERROR 2022-03-29 22:33:18 +02:00
Sylvestre Ledru
5b09008fc0
Merge pull request #3330 from sylvestre/debug-test
makefile: also build basenc
2022-03-29 22:33:05 +02:00
Sylvestre Ledru
05ec34eb94
Merge pull request #3322 from jfinkels/df-multiple-columns-error
df: error on duplicate columns in --output arg
2022-03-29 22:30:14 +02:00
Sylvestre Ledru
52b2d2ac1c
Merge pull request #3309 from cakebaker/fix_use_percentage_calculation
df: fix calculation of Use% column
2022-03-29 15:19:52 +02:00
Sylvestre Ledru
136803ef3d makefile: also build basenc 2022-03-28 23:11:17 +02:00
Sylvestre Ledru
746e35c34e
Merge pull request #3329 from DevSabb/shuf-gnu-test
shuf: accept multiple occurances of head-count argument
2022-03-28 22:09:18 +02:00
Daniel Hofstetter
e152ebaead df: fix calculation of Use% column
Change formula from: "Used/Size * 100" to "Used/(Used + Avail) * 100".
This formula also works if "Used" and "Avail" do not add up to "Size",
which is the case if there are reserved disk blocks.
2022-03-28 18:57:12 +02:00
DevSabb
36ec76e1fa
Merge branch 'uutils:main' into shuf-gnu-test 2022-03-28 12:56:38 -04:00
Ackerley Tng
e9131e2b7f wc: compute number widths using total file sizes
Previously, individual file sizes were used to compute the number width, which
would cause misalignment when the total has a greater number of digits, and is
different from the behavior of GNU wc

```
$ ./target/debug/wc -w -l -m -c -L deny.toml GNUmakefile
  95  422 3110 3110   85 deny.toml
 349  865 6996 6996  196 GNUmakefile
 444 1287 10106 10106  196 total
$ wc -w -l -m -c -L deny.toml GNUmakefile
   95   422  3110  3110    85 deny.toml
  349   865  6996  6996   196 GNUmakefile
  444  1287 10106 10106   196 total
```
2022-03-28 18:56:34 +02:00
Sylvestre Ledru
d6fd701511
Merge pull request #3327 from cakebaker/ticket_3324
df: --output w/o "=" doesn't expect further args
2022-03-28 18:51:06 +02:00
DevSabb
eeafdc7021 fix lint errors attempt 2 2022-03-28 11:36:50 -04:00
DevSabb
bb64e699ec fix lint errors 2022-03-28 11:33:38 -04:00
DevSabb
68b1f04f7d fix more clippy warnings 2022-03-28 11:09:26 -04:00
DevSabb
16ad4bc069 fix clippy warning 2022-03-28 10:31:27 -04:00
DevSabb
f6cb42ee2d shuf: accept multiple occurances of head-count argument 2022-03-28 10:17:07 -04:00
Daniel Hofstetter
a68d77b8cf df: --output w/o "=" doesn't expect further args
"df --output ." was treated as "df --output=." and hence "." was
interpreted as a column name. With this commit, "." is treated as
an argument on its own.

Fixes #3324
2022-03-28 10:13:54 +02:00
Sylvestre Ledru
b07b71e6be
Merge pull request #3323 from jfinkels/df-multiple-output-occurrences
df: allow multiple occurrences of --output arg
2022-03-28 08:36:50 +02:00
Jeffrey Finkelstein
a1f300e8a7 df: allow multiple occurrences of --output arg
Allow multiple occurrences of the `--output` argument. For example,

    $ df --output=source --output=target | head -n1
    Filesystem                Mounted on
2022-03-27 22:14:16 -04:00
Jeffrey Finkelstein
6f32a1921a df: error on duplicate columns in --output arg
Print a usage error when duplicat column names are specified to the
`--output` command-line argument. For example,

    $ df --output=source,source
    df: option --output: field ‘source’ used more than once
    Try 'df --help' for more information.
2022-03-27 22:02:55 -04:00
Sylvestre Ledru
d5d6bc3050
Merge pull request #3294 from jfinkels/df-file-column
df: implement the File column
2022-03-27 23:41:50 +02:00
Sylvestre Ledru
c932236826
Merge pull request #3317 from sylvestre/ls-quote
ls: Add proper quotes on symlink with --quoting-style=shell-escape
2022-03-27 19:22:18 +02:00
Jeffrey Finkelstein
ab717ce370 df: implement the File column
Implement the "File" column in the `df` output table. Before this
commit, a blank entry appeared in the "File" column for each
row. After this commit, a "-" entry appears when `df` is run with no
positional arguments and the filename appears when run with positional
arguments. For example:

    $ touch a b c && df --output=target,file a b c
    Mounted on File
    /          a
    /          b
    /          c
2022-03-27 13:17:36 -04:00
Sylvestre Ledru
e1f8893289
Merge pull request #3314 from jfinkels/timeout-return-125-invalid-args
timeout: return 125 on invalid time interval args
2022-03-27 18:28:56 +02:00
Jeffrey Finkelstein
b34685f8a5 timeout: return 125 on invalid time interval args
Exit with status 125 (indicating an error in `timeout` itself) when
the timeout duration is invalid or the "kill after" duration is
invalid.
2022-03-27 11:45:51 +02:00
Sylvestre Ledru
9a0ef9a81f
Merge pull request #3313 from jfinkels/timeout-kill-after-long-arg
timeout: support long form of --kill-after arg
2022-03-27 11:45:11 +02:00
Sylvestre Ledru
239998243f
Merge pull request #3316 from jfinkels/build-reduce-timeout-replacements
util: use uutils timeout in GNU tests
2022-03-27 11:44:39 +02:00
Sylvestre Ledru
c79d146dde ls: add support for --quoting-style=shell-escape b --color=auto 2022-03-27 10:50:00 +02:00
Sylvestre Ledru
bbee22bb1c ls: Add missing quote with --quoting-style=shell-escape
Should fix GNU: tests/ls/symlink-quote.sh
2022-03-27 10:50:00 +02:00
Jeffrey Finkelstein
c43ef8b704 timeout: support long form of --kill-after arg
Add support for the long form of the `--kill-after`
argument. Previously only the short form `-k` was supported.
2022-03-26 20:20:30 -04:00
Sylvestre Ledru
98376d8fd5
Merge pull request #3311 from uutils/mkdir2
mkdir: gnu compat: add support of mkdir -p foo/.
2022-03-27 00:15:05 +01:00
Jeffrey Finkelstein
5f8567695c util: use uutils timeout in GNU tests
Remove the substitution of uutils `timeout` with GNU `timeout` before
running the GNU test suite. Some of these replacements were not
actually operational because the regex was not appropriate (for
example, the test file had `timeout 10` but the regex would only match
`timeout [0-9]`). Others no longer need to be used because the uutils
version of `timeout` works well enough now to terminate a process
within the given period of time.
2022-03-26 19:35:19 +01:00
Sylvestre Ledru
3e39209078
Merge pull request #3315 from jfinkels/uucore-parse-time-uppercase
uucore: no uppercase suffixes in parse_time
2022-03-26 19:17:32 +01:00
Jeffrey Finkelstein
6a8ce447b7 uucore: no uppercase suffixes in parse_time
Disallow uppercase unit suffixes "S", "M", "H", and "D" in
`uucore::parse_time::from_str()` to match the behavior of GNU `sleep`
and `timeout`.
2022-03-26 10:39:00 -04:00
Sylvestre Ledru
5fba2a78da
Merge pull request #3293 from jfinkels/dd-conv-block-helper-remove-input
dd: create ConversionMode to simplify conversion, blocking, and unblocking
2022-03-26 10:10:48 +01:00
Sylvestre Ledru
2e476cfebd
Merge pull request #3307 from uutils/dependabot/cargo/redox_syscall-0.2.12
build(deps): bump redox_syscall from 0.2.10 to 0.2.12
2022-03-26 10:10:31 +01:00
Sylvestre Ledru
fbb64b9c5c mkdir: gnu compat: add support of mkdir -p foo/. 2022-03-25 21:35:27 +01:00
dependabot[bot]
f6981ba3f0
build(deps): bump redox_syscall from 0.2.10 to 0.2.12
Bumps redox_syscall from 0.2.10 to 0.2.12.

---
updated-dependencies:
- dependency-name: redox_syscall
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-25 20:02:46 +00:00
Jeffrey Finkelstein
f856bfc479 dd: move ConversionMode parsing to parseargs mod.
Move the code for parsing the `ConversionMode` to use up to the
`parseargs` module. This location makes more sense for it because the
conversion mode can be determined entirely from the command-line
arguments at the time of parsing just like the other parameters. Using
an enum for this purpose also eliminates the amount of code we need
later on.
2022-03-25 20:56:38 +01:00
Jeffrey Finkelstein
b98bccf9cc dd: move ConversionMode parsing to dd.rs
Move parsing of the `ConversionMode` outside of
`conv_block_unblock_helper()` and up to the code that calls it.
2022-03-25 20:56:38 +01:00
Jeffrey Finkelstein
bd626df70e dd: replace cascading if/else if with enum match
Replace a cascading `if/else if` chain in `conv_block_unblock_helper()`
with a match statement on a new enum, `ConversionMode`, that enumerates
the various modes in which `dd` can operate.
2022-03-25 20:56:38 +01:00
Terts Diepraam
6b8ab37ad9
Merge pull request #3308 from sylvestre/ci
CI: Force the rustc nightly version to fix issue 3305
2022-03-25 20:36:56 +01:00
Sylvestre Ledru
9e86e56668
Remove a comment to retrigger the CI 2022-03-25 15:28:45 +01:00
Sylvestre Ledru
22e06c2458 also fix coverage 2022-03-25 12:06:41 +01:00
Sylvestre Ledru
c4d89ab146 ci try to fix the error ? 2022-03-25 11:01:05 +01:00
Sylvestre Ledru
2acac0d558 CI: Force the rustc nightly version to fix issue 3305 2022-03-25 09:41:01 +01:00
Sylvestre Ledru
0ffc162daa
Merge pull request #3301 from sylvestre/assert_eq
use assert_eq instead of x == y. Better output in case of error
2022-03-24 08:18:08 +01:00
Sylvestre Ledru
fe648b2666
Merge pull request #3297 from jfinkels/timeout-invalid-signal
timeout: produce usage error on invalid signal
2022-03-23 21:05:34 +01:00