Commit graph

1738 commits

Author SHA1 Message Date
Jeffrey Finkelstein
460bd67050 df: show error when file argument does not exist
For example:

    $ df not-a-file
    df: not-a-file: No such file or directory

Fixes #3373.
2022-04-10 22:22:18 -04:00
Jeffrey Finkelstein
c5413167e2 df: correct --total argument used in unit test
Add a missing dash to the `--total` argument applied in the
`test_df_output` test case. Before this commit, the argument `-total`
was treated as a path argument. After this commit, `--total` is
treated as a command-line option that causes the total file usage to
be displayed.
2022-04-10 22:22:18 -04:00
Sylvestre Ledru
a2cefd9b52 du: Return non zero error code when dealing with permissions errors
Nd make the tests/du/no-x.sh & long-sloop.sh pass
2022-04-10 01:47:39 +02:00
Jeffrey Finkelstein
7192856da4 tests: print stdout in error msg for no_stdout()
Fix a bug in which the error message displayed when using
`CmdResult::no_stdout()` was incorrectly showing stderr when it should
have been showing stdout.
2022-04-09 12:44:24 -04:00
Sylvestre Ledru
d0aa9a9927
Merge pull request #3343 from uutils/dependabot/cargo/lscolors-0.9.0
build(deps): bump lscolors from 0.7.1 to 0.9.0
2022-04-09 09:29:25 +02:00
Sylvestre Ledru
935bdd4210
Merge pull request #3368 from tertsdiepraam/msrv-1.56
Rust Edition 2021
2022-04-07 11:46:42 +02:00
Terts Diepraam
54b2fe700b fix regressed test due to lscolors update 2022-04-07 11:05:20 +02:00
Kai Lüke
e894e40c56
hashsum: add --no-names option from official b3sum tool (#3361)
* hashsum: add --no-names option from official b3sum tool

The official b3sum tool has a --no-names option for only printing the
hashes, omitting the filenames. This is quite handy when used from
scripts because it spares the postprocessing with "cut" or "awk".
Since the installed b3sum symlink would also serve as a drop-in for the
official tool, the --no-names option is expected to exist for
compatibility.

Add a --no-names option not only for b3sum but for hashsum in general
(and maybe GNU coreutils will also feel inspired to add this option).

Closes https://github.com/uutils/coreutils/issues/3360
2022-04-06 09:09:37 +02:00
Daniel Hofstetter
876924f5d5 df: show error if same type is included & excluded
Fixes #3302
2022-04-05 14:21:32 +02:00
Terts Diepraam
18369dc0be all: use array intoiterator 2022-04-05 10:39:31 +02:00
Terts Diepraam
c6c936f529 all: remove explicit imports of TryFrom and TryInto
This is enabled by the changing the edition from 2018 to 2021
2022-04-05 10:39:31 +02:00
Terts Diepraam
af9f718936 Change edition to 2021 2022-04-05 10:39:31 +02:00
Sylvestre Ledru
cf722d7f0c tty: should not return 2 when --help is used
This is impacting
gnu/tests/misc/usage_vs_getopt.sh
2022-04-04 22:55:36 +02:00
Sylvestre Ledru
a219d9e355
Merge pull request #3353 from sylvestre/install
install: support of `-d dir/.` to match GNU's
2022-04-03 19:31:48 +02:00
Sylvestre Ledru
74a348161e install: add tests to test with multiple directories
to please @calixteman
2022-04-03 16:47:06 +02:00
Sylvestre Ledru
2628f3ed60 install: support of -d dir/. to match GNU's 2022-04-03 16:47:06 +02:00
Sylvestre Ledru
02cc67c915 rm: rename none by --interactive=never to fix ../gnu/tests/rm/i-never.sh 2022-04-03 09:15:45 +02:00
Sylvestre Ledru
ef8921044b
Merge pull request #3347 from cakebaker/fix_total_use_percentage
df: fix calculation of Use% in "total" row
2022-04-02 09:53:08 +02:00
Terts Diepraam
f00ec12e4f
Merge pull request #3345 from DevSabb/presume-input-pipe
head, tail: include presume-input-pipe parameter
2022-04-01 21:43:47 +02:00
DevSabb
1eee2194a3 head, tail: include presume-input-pipe parameter 2022-04-01 11:55:33 +02:00
Sylvestre Ledru
b3d87b088d ln: adjust the error messages 2022-04-01 09:25:35 +02:00
Daniel Hofstetter
bf69c63e09 df: Fix calculation of Use% in "total" row
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-04-01 08:25:30 +02:00
Sylvestre Ledru
676283ce93 ln: implement fixes for tests/ln/backup-1.sh
When doing
ln b b~
ln -f --b=simple a b

First, we create a backup of b
Then, we force the override of a => b but we make sure that the backup is
done.

So, we had a bug in the ordering of the actions.
we were first removing b. Therefore, losing the capability to do a backup of this.
2022-03-31 23:39:42 +02:00
Sylvestre Ledru
050b5b0c9b ln: make the tests/ln/hard-backup.sh test work
We haven't a great error message with hard link on the same file

+ Update the GNU error message to match ours
2022-03-30 20:00:11 +02:00
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
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
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
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
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
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
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
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
fbb64b9c5c mkdir: gnu compat: add support of mkdir -p foo/. 2022-03-25 21:35:27 +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
Sylvestre Ledru
33c49666c3
nproc: make tests/misc/nproc-override.sh pass by implementing OMP_NUM_THREADS=X,Y,Z (#3296)
+ nproc tests: use assert_eq when comparing the two values

Co-authored-by: jfinkels <jfinkels@users.noreply.github.com>
2022-03-23 12:12:54 +01:00
Sylvestre Ledru
ba83e5e901 use assert_eq instead of x == y. Better output in case of error 2022-03-23 10:41:31 +01:00
Jeffrey Finkelstein
760a15aa74 timeout: produce usage error on invalid signal
Produce a usage error on an invalid signal argument. For example,

    $ timeout --signal=invalid 1 sleep 0
    timeout: 'invalid': invalid signal
    Try 'timeout --help' for more information.
2022-03-23 08:39:55 +01:00