Commit graph

5487 commits

Author SHA1 Message Date
Michael Debertol
5bf4536bdd sort: ignore failure to truncate the output file 2021-07-31 21:02:20 +02:00
Michael Debertol
f29239beec sort: buffer writes to the output
This fixes a regression from a33b6d87b5
2021-07-31 21:02:20 +02:00
Michael Debertol
849086e9c5 sort: handle cases where the output file is also an input file
In such cases we have to create a temporary copy of the input file to prevent
overwriting the input with the output. This only affects merge sort, because it
is the only mode where we start writing to the output before having read all inputs.
2021-07-31 21:02:18 +02:00
Sylvestre Ledru
103a9d52ff
Merge pull request #2521 from miDeb/sort/rand
sort: improve compatibility of --random-sort
2021-07-31 21:00:18 +02:00
Sylvestre Ledru
897693c997
Merge pull request #2522 from miDeb/sort/unique-check
sort: disallow equal lines for --check with --unique
2021-07-31 20:59:25 +02:00
Michael Debertol
3564dc5792 sort: compare strings before comparing hashes
Since lines that compare equal should be sorted together, we need to first
compare the lines (taking settings into account). Only if they do not compare
equal we should compare the hashes.
2021-07-31 20:07:05 +02:00
Michael Debertol
f851fb6454 sort: initialize the salt when the random setting is on a key as well
Additionall, change the type of `salt` from `String` to `Option<[u8; 16]>`.
2021-07-31 20:07:05 +02:00
Michael Debertol
095e53aed2 sort: disallow equal lines for --check with --unique 2021-07-31 19:57:41 +02:00
Sylvestre Ledru
6b73ddcd12 Silent the spell checker on a test examples 2021-07-31 10:38:32 +02:00
Sylvestre Ledru
1eb3b62c46
Merge pull request #2537 from jfinkels/expand-improve-tabs-argument-2
expand: expand support for --tabs arguments
2021-07-31 10:33:08 +02:00
Sylvestre Ledru
638b31a877
Merge pull request #2520 from miDeb/sort/fixes
sort: fix some exit codes and error messages
2021-07-31 10:11:12 +02:00
Sylvestre Ledru
8620220298
Merge pull request #2511 from dezgeg/stat-t
stat: Support \t in --printf format
2021-07-31 09:52:42 +02:00
Sylvestre Ledru
82a02bf2eb
Merge pull request #2512 from syukronrm/df-uresult
df: add `UResult`
2021-07-31 09:52:22 +02:00
Sylvestre Ledru
fd02ef2dc1
Merge pull request #2516 from jfinkels/tac-read-dir-error-message
tac: correct error message when reading from directory
2021-07-31 09:49:54 +02:00
Sylvestre Ledru
00f6fce89d
Merge pull request #2518 from jfinkels/tac-no-line-separators-in-file
tac: handle no line separators in file
2021-07-31 09:44:29 +02:00
Sylvestre Ledru
938f79aebc
Merge branch 'master' into sort/fixes 2021-07-31 09:42:35 +02:00
Sylvestre Ledru
56cc2cdd67
Merge pull request #2525 from miDeb/sort/nul-tab
sort: allow null bytes for -t
2021-07-31 09:28:01 +02:00
Jeffrey Finkelstein
fb477360b2 expand: expand support for --tabs arguments
Add support for

* space-separated list of tab stops, like `--tabs="2 4 6"`,
* mixed comma- and space-separated lists, like `--tabs="2,4 6"`,
* the slash specifier in the last tab stop, like `--tabs=1,/5`,
* the plus specifier in the last tab stop, like `--tabs=1,+5`.
2021-07-30 23:46:02 -04:00
Michael Debertol
4759505024 sort: split a line to make rustfmt work again 2021-07-30 23:41:18 +02:00
Michael Debertol
1bb530eebb sort: validate input files at startup 2021-07-30 23:41:18 +02:00
Michael Debertol
a33b6d87b5 sort: open the output file at the beginning
This causes us to print an error message about an invalid output file
right at the start of the invocation, but *after*  verifying other arguments.
2021-07-30 23:40:53 +02:00
Michael Debertol
c6e044927c sort: print check messages to stderr, not stdout 2021-07-30 23:37:35 +02:00
Michael Debertol
891d25cebd sort: fix exit codes and error messages 2021-07-30 23:37:35 +02:00
Michael Debertol
a214ca60bd sort: allow null bytes for -t 2021-07-30 23:30:52 +02:00
Sylvestre Ledru
12dc3db972
Merge pull request #2526 from miDeb/sort/usage
sort: remove duplication from usage string
2021-07-30 22:45:10 +02:00
Sylvestre Ledru
aa1082cbf8
Merge pull request #2533 from sylvestre/grcov-update
Fix the CI (coverage + clippy)
2021-07-30 22:02:24 +02:00
Sylvestre Ledru
3e096491f3 Remove clippy allow
was causing
unused attribute `allow`
2021-07-30 15:23:25 +02:00
Sylvestre Ledru
f34505df54 bump the minimal version for coverage to 1.52
Drivers:
https://github.com/rust-lang/rust/issues/71395
https://github.com/rust-lang/rust/pull/80470
needed by grcov
2021-07-30 14:54:45 +02:00
Michael Debertol
bd7d8fdde7 sort: remove duplication from usage string
The custom usage string does not have to include the "sort\nUsage:" part,
because this part is already printed by clap.

It prevents the following duplication:

USAGE:
    sort
Usage:
 sort [OPTION]... [FILE]..

Now, only the following is printed:

USAGE:
    sort [OPTION]... [FILE]...
2021-07-27 23:58:44 +02:00
Sylvestre Ledru
978033a241
Merge pull request #2519 from jfinkels/pathchk-remove-double-negation
pathchk: remove double negation
2021-07-26 13:42:58 +02:00
Sylvestre Ledru
a1530b420f
Merge pull request #2514 from sagudev/revert-2475-clip
Revert "silent buggy clippy warning"
2021-07-26 09:19:28 +02:00
Jeffrey Finkelstein
3c7940ddfd pathchk: remove double negation 2021-07-25 16:22:22 -04:00
Jeffrey Finkelstein
2648f330e4 tac: handle no line separators in file
Change the behavior of `tac` when there are no line separators in the
input. Previously, it was appending an extra line separator; this commit
prevents that from happening. The input is now writted directly to
stdout.
2021-07-25 15:19:29 -04:00
Jeffrey Finkelstein
abf4c69b28 tac: correct error message when reading from dir.
Correct the error message produced by `tac` when trying to read from a
directory. Previously if the path 'a' referred to a directory, then
running `tac a` would produce the error message

    dir: read error: Invalid argument

after this commit it produces

    a: read error: Invalid argument

which matches GNU `tac`.
2021-07-25 13:55:24 -04:00
sagudev
4f4338f1c0 Delete all allow(nonstandard_macro_braces) and fix other clippy warnings 2021-07-25 18:51:16 +02:00
sagu
9702aa6414
Revert "silent buggy clippy warning" 2021-07-25 18:06:41 +02:00
Sylvestre Ledru
c98e7f5de9
Merge pull request #2510 from dhodder/licensing_doc
CONTRIBUTING: Add Apache License note (#2086)
2021-07-25 14:27:17 +02:00
Dave Hodder
3af8a89bce CONTRIBUTING: Add Apache as valid license (#2086) 2021-07-25 12:27:26 +01:00
Syukron Rifail M
5c7afe7a6b df: add UResult 2021-07-24 20:18:57 +07:00
Tuomas Tynkkynen
46a2491727 stat: Support \t in --printf format 2021-07-23 19:04:18 +03:00
Dave Hodder
2dc9dfe62f CONTRIBUTING: adjust formatting 2021-07-22 18:02:51 +01:00
Dave Hodder
38a47b4358 CONTRIBUTING: Add Apache License note (#2086)
Add a note the licensing section, stating that references using the
Apache License are acceptable on a case-by-case basis when there is no
MIT-licensed alternative.

  * Follow-up to #1994 / https://github.com/uutils/coreutils/pull/2493

  * Intended to resolve issue #2086
2021-07-22 17:38:43 +01:00
Terts Diepraam
eae8c72793
Merge pull request #2467 from Funky185540/backup_mode_determination
backup_control: Fix backup mode determination
2021-07-20 13:27:04 +02:00
Andreas Hartmann
e07b4e9f59 install: Adapt to modified backup mode determination 2021-07-19 17:01:49 +02:00
Andreas Hartmann
250bcaf7c5 backup_control: Run tests in series
Make all tests lock a mutex to ensure that they're run in series rather than
parallel. We must take this precaution due to the fact that all tests are run
in parallel as threads of one parent process. As all threads in a process share
e.g. environment variables, we use the Mutex to ensure they're run one after
another.

This way we can guarantee that tests that rely on environment variables to have
specific values will see these variables, too.

An alternative implementation could have used the [rusty fork][1] crate to run
all tests that need env variables in separate processes rather than threads.
However, rusty fork likely wouldn't run on all platforms that the utilities are
supposed to run on.
2021-07-19 17:01:49 +02:00
Andreas Hartmann
2db1ec99f1 ln: Adapt to modified backup mode determination 2021-07-19 17:01:49 +02:00
Andreas Hartmann
3a0164310a cp: Adapt to modified backup mode determination 2021-07-19 17:01:49 +02:00
Terts Diepraam
fd89d59980
Merge pull request #2501 from Funky185540/docs/uerror_methods
uucore: error: Add docs to the `code` and `usage` functions
2021-07-19 14:44:36 +02:00
Sylvestre Ledru
e86c989184
Merge pull request #2505 from syukronrm/du-time-birth
test_du: ignore unsupported --time=birth
2021-07-19 09:54:47 +02:00
Andreas Hartmann
3a5caec5c2 uucore: error: Add docs to the code and usage functions
Make it plain what each of the functions is meant to implement and how they are
supposed to work.
2021-07-19 08:53:35 +02:00