Commit graph

812 commits

Author SHA1 Message Date
Michael Debertol
080998b6ef chmod: pad all file modes to 4 digits 2021-08-25 13:52:09 +02:00
Jan Verbeek
e5d6c6970b yes: Cleanup
Report errors properly instead of panicking.

Replace zero_copy by a simpler specialized private module.

Do not assume splices move all data at once.

Use the modern uutils machinery.

Remove the "latency" feature. The time it takes to prepare the buffer
is drowned out by the startup time anyway.

yes: Add tests

yes: Fix long input test on Windows
2021-08-25 13:45:44 +02:00
Michael Debertol
7153a595c6 chgrp: forward to chown
chgrp does mostly the same as chown.
By making chown a bit more configurable we can reuse its code for chgrp.
2021-08-24 15:22:05 +02:00
Sylvestre Ledru
68c9bfa658
Merge pull request #2581 from sylvestre/freebsd
Use github action for FreeBSD testing and remove cirrus CI
2021-08-24 14:47:34 +02:00
Michael Debertol
91a8f533b6
Merge pull request #2582 from jfinkels/tac-multi-char-separator-overlap
tac: support multi-character line separator with possible overlaps
2021-08-24 12:03:45 +02:00
Jan Verbeek
516c5311f7
Close file descriptors of pipes after use (#2591)
* Close file descriptors of pipes after use

* cat: Test file descriptor exhaustion

* fixup! cat: Test file descriptor exhaustion
2021-08-24 12:00:07 +02:00
Sylvestre Ledru
697dca25cb silent the failed tests for now on freebsd 2021-08-24 09:32:27 +02:00
Sylvestre Ledru
78e28060a0 NORMAL_FORMAT_STR is also used for freebsd 2021-08-24 09:32:27 +02:00
Jeffrey Finkelstein
0e689e78aa tac: support multi-char separator with overlap
Fix a bug in `tac` where multi-character line separators would cause
incorrect behavior when there was overlap between candidate matches in
the input string. This commit adds a dependency on `memchr` in order to
use the `memchr::memmem::rfind_iter()` function to scan for
non-overlapping instances of the specified line separator characters,
scanning from right to left.

Fixes #2580.
2021-08-23 20:16:38 -04:00
jfinkels
bdc0f4b7c3
hashsum: support --check for algorithms with variable output length (#2583)
* hashsum: support --check for var. length outputs

Add the ability for `hashsum --check` to work with algorithms with
variable output length. Previously, the program would terminate with an
error due to constructing an invalid regular expression.

* fixup! hashsum: support --check for var. length outputs
2021-08-23 18:35:19 +02:00
Sylvestre Ledru
9f3debeda3
Merge pull request #2534 from jfinkels/basename-handle-slashes
basename: handle paths comprising only slashes
2021-08-22 22:49:30 +02:00
Koutheir Attouchi
7010dfd939 runcon: added implementation and tests. 2021-08-22 21:59:41 +02:00
jfinkels
4ef35d4a96
tac: correct behavior of -b option (#2523)
* tac: correct behavior of -b option

Correct the behavior of `tac -b` to match that of GNU coreutils
`tac`. Specifically, this changes `tac -b` to assume *leading* line
separators instead of the default *trailing* line separators.

Before this commit, the (incorrect) behavior was

    $ printf "/abc/def" | tac -b -s "/"
    def/abc/

After this commit, the behavior is

    $ printf "/abc/def" | tac -b -s "/"
    /def/abc

Fixes #2262.

* fixup! tac: correct behavior of -b option

* fixup! tac: correct behavior of -b option

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2021-08-22 21:01:17 +02:00
Sylvestre Ledru
114c9a409c
Merge pull request #2471 from miDeb/real-exe-name
make executable!() return the real executable name
2021-08-22 16:55:06 +02:00
Jeffrey Finkelstein
fbb81f7088 tests(head): change file mode from 755 to 644 2021-08-21 22:59:59 -04:00
Michael Debertol
5e07d58a4d
Merge pull request #2459 from jaggededgedjustice/realpath-add-physical-mode
Add Physical mode to realpath
2021-08-21 02:01:10 +02:00
Michael Debertol
5f2335829a refactor ~ revert to single quotes for "Try '{0 --help'"
This is a test expectation for gnu.
2021-08-14 17:22:09 +02:00
Roy Ivy III
4da46d93c7 tests ~ fix tests for new execution_phrase!() and usage phrasing 2021-08-14 14:01:34 +02:00
Terts Diepraam
f9559fea80
Merge pull request #2569 from jtracey/master
join: add support for full outer joins
2021-08-13 14:38:15 +02:00
Justin Tracey
1bb0237281 join: add support for full outer joins 2021-08-12 23:52:35 -04:00
Sylvestre Ledru
a7797c01c0
Merge branch 'master' into chgrp/no-err 2021-08-13 01:35:21 +02:00
Sylvestre Ledru
8f55c79c9b
Merge pull request #2566 from miDeb/ls/width
ls: correct output width
2021-08-13 01:31:52 +02:00
Sylvestre Ledru
f98415051b
Merge pull request #2567 from miDeb/pr/tests
pr: reduce test flakiness
2021-08-13 01:30:19 +02:00
Michael Debertol
ce1323ce1c cp: do not set the current directory in tests
Setting the current directory in tests affects other tests, even if the
change is reverted after, because tests are run in parallel.

This should fix the flaky cp tests.
2021-08-12 22:42:40 +02:00
Michael Debertol
1725bf6a36 pr: reduce test flakiness
Since some tests run multiple commands, we have to re-calculate the
expected result for every run.
This is because the expected results depend on file timestamps, but the
files are re-created for every new TestScenario.
2021-08-12 17:03:06 +02:00
Michael Debertol
0af244ac42 ls: default to one-line output if stdout is not a tty 2021-08-11 22:03:41 +02:00
Michael Debertol
988cc49d4a ls: print a single line when width is set to 0
This means that we treat a width=0 as infinite width.
2021-08-11 19:12:45 +02:00
Michael Debertol
13a62489c5 ls: correct fallbacks for terminal width
If options::WIDTH is not given, we should try to use the terminal width.
If that is unavailable, we should fall back to the 'COLUMNS' environment variable.
If that is unavailable (or invalid), we should fall back to a default of 80.
2021-08-11 19:12:37 +02:00
Michael Debertol
1c30fb42d2 chgrp: handle empty group 2021-08-11 19:03:41 +02:00
Michael Debertol
0edc9b01b9 factor: prevent writing incomplete lines
This makes it possible to execute multiple `factor` instances that write
to the same output in parallel, without having them interfere.
2021-08-10 00:14:51 +02:00
Sylvestre Ledru
966cf79747
Merge pull request #2551 from uutils/od-hang
od: fix reading from file while supplying a format argument
2021-08-09 12:36:31 +02:00
Sylvestre Ledru
ee98efd92e
Merge pull request #2552 from miDeb/cat/show-crlf
cat: show `\r\n` as `^M$` when `-E` is enabled
2021-08-09 12:23:59 +02:00
Michael Debertol
312e1ce9e0 chgrp: don't output an empty error 2021-08-09 01:33:02 +02:00
Michael Debertol
03ceb6750e cat: check if the input file is also the output file 2021-08-08 01:32:22 +02:00
Michael Debertol
7229360217 cat: remove all per-file state
cat cannot keep per-file state, so move all remaining state (one_blank_kept)
to the global state.
2021-08-07 23:04:25 +02:00
Michael Debertol
5be4c48546 cat: show \r\n as ^M$ when -E is enabled
This functionality was recently added to GNU cat, but had a bug.
This implementation will be commpatible with gnu once the bug in gnu is fixed.
2021-08-07 21:18:15 +02:00
Jeremy Soller
6af3f774f1
od: fix reading from file while supplying a format argument
The following test case read stdin instead of file:
```
echo abcdefg > file
cargo run -- od --format x1 file
```

This is because the -t/--format argument was able to absorb multiple
arguments after it. This has now been fixed, and a test case is added
to ensure it will not happen again.
2021-08-06 15:07:38 -06:00
Sylvestre Ledru
32d281bbcc
Merge pull request #2544 from miDeb/sort/delete-tmps
sort: delete temporary files when sort is terminated
2021-08-06 11:52:06 +02:00
Michael Debertol
0ae9e10ed3 sort: delete the temporary directory when sort is terminated
When hitting Ctrl+C sort now deletes any temporary files. To make this easier I
created a new struct `TmpDirWrapper` that handles the creation of new temporary
files and the registration of the signal handler.
2021-08-06 11:29:24 +02:00
Sylvestre Ledru
50b9d9f9a3
Merge branch 'master' into master 2021-08-06 09:26:39 +02:00
Koutheir Attouchi
090be5bb94 chcon: added implementation and integration tests
The ToDo list was updated to mark `chcon` as done.

Building and testing `chcon` requires enabling the `feat_selinux` feature. If `make` is used for building, then please specify `SELINUX_ENABLED=1` if building and testing on a system where SELinux is not enabled.
2021-08-05 22:57:57 -04:00
Michael Debertol
b8c383e210 basenc: add utility
basenc is a brand-new gnu core utility (added less than 3 years ago!),
which enables some more encodings.
2021-08-06 00:07:19 +02:00
backwaterred
2c41838166
Merge branch 'uutils:master' into master 2021-08-04 12:47:47 -07:00
Tyler
0864234e3d Removes unused macros from windows & macos builds 2021-08-04 12:47:03 -07:00
Tyler
601c9fc620 Merge branch 'master' of https://github.com/uutils/coreutils into uutils-master-2 2021-08-03 17:33:43 -07:00
Michael Debertol
9700f0503d base32/64: adjust error message to match gnu 2021-08-04 00:04:25 +02:00
Michael Debertol
44ae927969 base32/64: print the first extra operand, not the one before
Only one operand is allowed, so when there are multiple arguments we
should print the second argument in the error.
2021-08-03 23:37:20 +02:00
Sylvestre Ledru
26cc2ed440
Merge pull request #2517 from jfinkels/tac-null-separator
tac: support null separator (-s "")
2021-08-03 09:22:50 +02:00
Jan Scheer
010565c8fb
Merge branch 'master' into id_selinux_context 2021-08-02 10:40:45 +02:00
Jeffrey Finkelstein
d74fb62df7 tac: support null separator 2021-08-01 19:47:21 -04:00