Commit graph

2838 commits

Author SHA1 Message Date
Daniel Hofstetter
0ad7389b61 tail: remove #[cfg(not(windows))] from const 2024-05-09 15:28:34 +02:00
Daniel Hofstetter
aef7933d96 tail: use #[ignore] to disable tests
instead of a cfg attribute
2024-05-09 15:07:10 +02:00
Anirban Halder
97f8361737 Switched to using at.symlink_file instead of ln in tests 2024-05-08 23:50:33 +02:00
Anirban Halder
88d9d46abc Added test for dangling symlink in target directory 2024-05-08 23:50:33 +02:00
Anirban Halder
1f81912b3c Added assertion of stderr strings for macos and windows and fixed lints 2024-05-08 23:50:33 +02:00
Anirban Halder
f7e55b1322 Added overwrite detection for existing symlinks 2024-05-08 23:50:33 +02:00
Sylvestre Ledru
eb6f1df3bc cksum: add an ignored test for issue 6375 2024-05-07 20:24:25 +02:00
Sylvestre Ledru
ee2772925a cksum: --tag & --untagged - the order of usage matters. manage it 2024-05-07 20:24:25 +02:00
Sylvestre Ledru
9e080a3684 cksum: handle a corner case 2024-05-07 20:24:25 +02:00
Sylvestre Ledru
234f2f9508 cksum: handle an error like GNU 2024-05-07 20:24:25 +02:00
Sylvestre Ledru
10d8fd6f98 cksum: add binary and prepare the rest 2024-05-07 20:24:25 +02:00
Sylvestre Ledru
dc5342d115 hashsum: allow multiple usage of -l and take the last one
tested by gnu/tests/cksum/b2sum.sh
2024-05-07 20:24:25 +02:00
Ben Wiederhake
ea18cfd3d8 fmt: fix error priority, make goal-errors more helpful 2024-05-06 19:36:39 +02:00
ahmadabd
a3d05e5945 fmt: value of minlength should not be negative
closes #6354
2024-05-05 21:08:38 +02:00
Ben Wiederhake
a13949b4ba fmt: add basic tests for split-only, prefix, and skip-prefix args 2024-05-05 17:03:28 +02:00
Ben Wiederhake
e76f92c212 fmt: accept repeated arguments 2024-05-05 16:13:46 +02:00
Jalil David Salamé Messina
ff1a03c284 tr: don't truncate when not translating
An additional issue was found while reviewing #6340, check [this thread][1]. A summary is:

- `tr` ignores the `-t`/`--truncate-set1` flag when not translating
- Not translating is defined as `-d` was passed, or one set was passed.

[1]: https://github.com/uutils/coreutils/pull/6340#discussion_r1590007053
2024-05-04 19:55:49 +02:00
Jalil David Salamé Messina
3c47f27698 tr: calculate complement set early
Fixes #6163 and adds a test to verify that a regression is not caused.

Instead of inverting the conditions to check (e.g. delete characters **not** present in set1) invert
set1 when passed the complement flag (`-c`, `-C`, `--complement`). This is done by calculating set1
then "inverting" it by subtracting from the "full" (universe) set (0..=u8::MAX).

This fixes issue 6163 because it was caused by a combination of the `-c` and `-t` flag. `-c` is the
abovementioned complement flag and `-t`/`--truncate-set1` truncates set1 to the length of set2. What
happened in issue 6163 is that `set1={b'Y'}` and `set2={b'Z'}`, when truncated set1 stays the same
and we proceed. The problem is GNU utils does not consider set1 to be `{b'Y'}`, but the complement
of `{b'Y'}`, that is `U \ {b'Y'}={0, 1, ..., b'X', b'Z', ...}`, thus it is truncated to `{0}`.

We can verify this by doing: `printf '\0' | tr -c -t Y Z`, which prints `Z` to stdout as expected.

Additionally, by calculating the complement of set1 we no longer need to consider the complement
flag when doing the translate operation, this allows us to delete a lot of code.
2024-05-04 19:55:49 +02:00
Anirban Halder
c5a530f4a1
Changed `/sys/kernel/address_bits to /sys/kernel/profiling` in test_cp (#6294)
* Changed sys/kernel/address_bits to sys/kernel/profiling

* Added comments and fixed formatting

---------

Co-authored-by: Anirban <anirban@pop-os.localdomain>
2024-05-02 18:25:22 +02:00
Sylvestre Ledru
b28b79da77
Merge pull request #6125 from cre4ture/feature/config_terminal_simulation
config terminal simulation for specific stdios only
2024-05-01 21:40:28 +02:00
Ben Wiederhake
909c47886a tr+tests: remove unused spell-checker:disable 2024-04-30 18:28:20 +02:00
Ben Wiederhake
48a483c319 sort+tests: remove unused spell-checker:disable 2024-04-30 18:28:20 +02:00
Ben Wiederhake
e4b6687196 realpath+tests: remove unused spell-checker:disable 2024-04-30 18:28:20 +02:00
Ben Wiederhake
289346a4ba printf+tests: remove unused spell-checker:disable 2024-04-30 18:28:20 +02:00
Ben Wiederhake
bebddc6ad4 od+tests: remove unused spell-checker:disable 2024-04-30 18:28:20 +02:00
Ben Wiederhake
a53ec17b67 numfmt+tests: remove unused spell-checker:disable 2024-04-30 18:28:20 +02:00
Ben Wiederhake
f1a683d45f mktemp+tests: remove unused spell-checker:disable 2024-04-30 18:28:20 +02:00
Ben Wiederhake
9266b4a7fa ls+tests: remove unused spell-checker:disable 2024-04-30 18:28:20 +02:00
Ben Wiederhake
63699a41d6 kill+tests: remove unused spell-checker:disable 2024-04-30 18:28:20 +02:00
Ben Wiederhake
b39b405826 basenc+tests: remove unused spell-checker:disable 2024-04-30 18:28:20 +02:00
Ben Wiederhake
db61684bc0 basename+tests: remove unused spell-checker:disable 2024-04-30 18:28:20 +02:00
Ben Wiederhake
34da5029df cat+tests: simplify spell-checker exceptions 2024-04-30 18:28:20 +02:00
Daniel Hofstetter
96ed764fda cp: remove panics in tests 2024-04-30 16:22:49 +02:00
Sylvestre Ledru
969fb2e818
Merge pull request #6287 from BenWiederhake/dev-fewer-test-leakage
od+tests: use TestScenario, avoid spamming /tmp on failure
2024-04-29 10:46:23 +02:00
Ben Wiederhake
4f5a3b4716 id: mark passwd-format and pretty-print as conflicting
These are non-sensical to combine, and didn't work reasonably anyway.
Also, passwd-formatting is our own extension, so there is no need for
compatibility anyway.
2024-04-28 23:05:43 +02:00
Ben Wiederhake
e978fe5382 id: permit repeated flags 2024-04-28 22:39:14 +02:00
Ben Wiederhake
ebb21d0bdf od+tests: use TestScenario, avoid spamming /tmp on failure 2024-04-28 21:49:31 +02:00
Darius Carrier
5ee9c69f59
kill: adding support for handling SIGEXIT (#6269)
kill: convert SIGEXT (0) to None so nix takes correct action
2024-04-27 17:33:45 +02:00
Sylvestre Ledru
4090d468c0
Merge pull request #6162 from BenWiederhake/dev-undo-custom-exit-codes
all: Undo custom exit codes
2024-04-25 08:11:41 +02:00
Daniel Hofstetter
89af8b9769 du,uucore: add words to spell-checker:ignore 2024-04-24 16:54:32 +02:00
Michael Vogt
61e0450c66 du: give -h output the same precision as GNU coreutils
When printing the `du -h` output GNU coreutils does autoscale
the size, e.g.
```
$ truncate -s12M a
$ truncate -s8500 b
$ truncate -s133456345 c
$ truncate -s56990456345 d
$ du -h --apparent-size a b c d
12M	a
8,4K	b
128M	c
54G	d
```
Align our version to do the same by sharing the code with `ls`.

Closes: #6159
2024-04-24 16:53:08 +02:00
Ulrich Hornung
537941b676 config terminal simulation for specific stdios only 2024-04-23 19:56:17 +02:00
Daniel Hofstetter
fabe9ac128 cp: remove unnecessary calls of touch() in tests 2024-04-23 15:28:22 +02:00
Anirban Halder
421b820ec2
Fix the debug results in cp --debug (#6220) 2024-04-22 17:02:21 +02:00
Daniel Hofstetter
a2bc0ffdb0 env: remove dependency on GNU env in tests 2024-04-22 14:55:14 +02:00
Sylvestre Ledru
d63bc4a4e1
seq: add the unit test even if they are failing for now (#6236)
* seq: add the unit test even if they are failing for now

* improve test

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-04-21 14:48:03 +02:00
Sylvestre Ledru
13cfe2d8e5 test: replace at.write by at.touch 2024-04-21 13:23:24 +02:00
Sylvestre Ledru
3a72d5c5cb test tail: replace fixtures by at for consistency 2024-04-21 13:20:38 +02:00
Ulrich Hornung
d202baba97 use num_prime for factorisation to fix gnu test 2024-04-21 11:24:25 +02:00
Sylvestre Ledru
64027e5a57
Merge pull request #6252 from sylvestre/hash-error
hashsum: improve the error management to match GNU
2024-04-21 09:55:16 +02:00
sreehari prasad
a1717436a4
cp: gnu "same-file" test case compatibility (#6190)
* cp: -b doesn't ignore "version control" env

* cp: gnu "same-file" test compatibility fix
2024-04-21 09:49:45 +02:00
Sylvestre Ledru
6ef08d7f1c hashsum: improve the error management to match GNU
Should make tests/cksum/md5sum.pl and tests/cksum/sha1sum.pl pass
2024-04-21 09:08:27 +02:00
Sylvestre Ledru
94f5e82dbd hashsum: ignore empty lines in --check 2024-04-21 09:08:27 +02:00
Daniel Hofstetter
c83cec7c0c env: move unit tests to env.rs 2024-04-21 01:26:50 +02:00
Daniel Hofstetter
29e5d0b42b clippy: fix redundant_clone lint warnings in tests 2024-04-21 01:26:50 +02:00
Sylvestre Ledru
4e1dbcd3fc
Merge pull request #6230 from sylvestre/hash-ignore-missing
hashsum: implement the ignore-missing option
2024-04-17 23:43:38 +02:00
binlingyu
9d1d4cc5f6 Fix warning when executing Clippy 2024-04-17 11:14:03 +08:00
Sylvestre Ledru
f817018f90 hashsum: --ignore-missing needs -c 2024-04-15 22:19:44 +02:00
Haisham
b617876372 kill: ignore signal case on -s 2024-04-15 03:27:51 +02:00
Haisham
524be6e4ae kill: accept all casings for signal names in --list 2024-04-15 03:27:51 +02:00
Sylvestre Ledru
b977d61f67 hashsum: implement the ignore-missing option
Tested by gnu/tests/cksum/md5sum.pl
2024-04-14 20:05:39 +02:00
Ben Wiederhake
3854569856 tee: ensure that -h and --help are identical 2024-04-14 15:42:13 +02:00
Ben Wiederhake
9527341714 pr: return correct exit code on error 2024-04-14 15:42:13 +02:00
Ben Wiederhake
f5f8cf08e0 hostid: return correct exit code on error 2024-04-14 15:42:13 +02:00
Ben Wiederhake
91679fc747 wc: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:47 +02:00
Ben Wiederhake
a699bfd1fb uniq: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
Ben Wiederhake
3285f95eb3 touch: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
Ben Wiederhake
25245bde65 tee: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
Ben Wiederhake
88a2ea4f3b tail: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
Ben Wiederhake
872ec050e4 sort: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
Ben Wiederhake
70d84e168c shred: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
Ben Wiederhake
1dd7d8e0db od: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
Ben Wiederhake
2646944bee numfmt: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
Ben Wiederhake
3877d14504 ls: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
Ben Wiederhake
27a81f3d32 du: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
Ben Wiederhake
d4546ced26 cp: accept shortcuts for stringly-enum arguments 2024-04-14 15:39:46 +02:00
Haisham
333e4d9fe9
kill: print --table as vertical (#6216)
* kill: print --table as vertical

* kill: remove signal padding on --table

* kill: skip exit signal in --table

* kill: replace "skip" with "filter"

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-04-14 15:08:51 +02:00
Jadi
9b4a787be7
kill: return 1 and gnu style stderr in case of no pid (#6225)
* kill: return 1 and gnu style stderr in case of no pid

closes #6221

* Update src/uu/kill/src/kill.rs

Co-authored-by: Ben Wiederhake <BenWiederhake.GitHub@gmx.de>

---------

Co-authored-by: Ben Wiederhake <BenWiederhake.GitHub@gmx.de>
2024-04-14 14:13:15 +02:00
Daniel Hofstetter
aaaf4c3f91 kill: don't show EXIT with --list 2024-04-14 13:42:55 +02:00
Haisham
d56c7bbaee kill: add test for vertical --list 2024-04-12 06:21:48 +02:00
Haisham
c4c81291b7 kill: add tests to check multiple output 2024-04-12 06:21:48 +02:00
Daniel Hofstetter
5bf939aec6
Merge pull request #6207 from BenWiederhake/pr/6069
cp: handle update prompt with and without interactive mode enabled
2024-04-11 14:55:26 +02:00
Vikrant2691
9b9c0cc237 cp: handle update prompt with and without interactive mode enabled 2024-04-09 15:14:33 +02:00
Ben Wiederhake
0375bc98a6 dd: fix flaky test_null_stats
If the first four decimal digits are zero, GNU dd elides them altogether.
Therefore, this test just contained an overly-strict regex.

See also ede944e1f8.
2024-04-07 22:45:35 +02:00
Ben Wiederhake
d5e7f9a4a4 wc: count ASCII control characters as word characters 2024-04-07 02:12:22 +02:00
Ulrich Hornung
eca8130a4a feature: env argv0 overwrite (unix only) 2024-04-07 01:27:30 +02:00
Jadi
5d17bf7d78 head: two new tests. Improves function coverage from 38 to 75 2024-04-06 05:40:26 +02:00
Jadi
1137d9a62d cut: two new tests; -d conflict & no arg 2024-04-04 21:33:22 +03:30
Jadi
4312f3c43e cksum: adding -b as the short form for --base64
closes #5706
2024-04-04 15:09:17 +03:30
Ben Wiederhake
714b4ff589 ls: fix exit code for --time-style when used 2024-04-01 22:57:18 +02:00
Ben Wiederhake
4a1bd78f48 ls: compute correct exit code on error
Note in particular that this seems to be the only tool where invalid
stringly-enum values cause a different exit code than invalid arguments.
2024-04-01 22:57:18 +02:00
Carbrex
49c7e65f5d Use time-style only if time is provided 2024-04-01 17:09:59 +02:00
Sylvestre Ledru
4482a6248f
Merge pull request #6157 from BenWiederhake/dev-tee-fail-open
tee: Correctly handle read-only files, avoid unnecessary wrapping
2024-04-01 01:41:40 +02:00
Paolo Barbolini
9e040a3df1 chore(deps): drop conv dev-dependency 2024-03-31 22:51:24 +02:00
Michael Vogt
af0ba86657 date: support -f - to read from stdin
So far `date -f -` was not reading from stdin. This commit fixes
this.

Closes: #6058
2024-03-31 22:05:47 +02:00
Ben Wiederhake
8ab825c49f tee: correctly handle writing to read-only files 2024-03-31 18:47:32 +02:00
Sylvestre Ledru
b869c67d6a
Merge pull request #6150 from BenWiederhake/dev-dircolors-repeated
dircolors: accept repeated flags
2024-03-31 12:08:55 +02:00
Ben Wiederhake
8e794d0654 dircolors: accept repeated flags 2024-03-30 22:50:57 +01:00
Ben Wiederhake
9dbf2c362d dirname: accept repeated flag 2024-03-30 22:50:52 +01:00
Michael Vogt
3a6bf34284
date: fix date -f dates.txt is failing (#6148)
* date: fix `date -f dates.txt is failing`

This commit is a trivial followup for:
https://github.com/uutils/coreutils/pull/4917
and
https://github.com/uutils/parse_datetime/pull/12

The functionality to parse the datetime was moved into the parse_datetime
crate and the only (tiny) piece left is to call it from `date`.

It also adds the test-case from the original issue. I did not include
the two tests from PR#4917 because they appear to work even without
this change. I am happy to include them of course if prefered.

Closes: #4657

Thanks to Ben Schofield

* tests: tweak changes to test_date.rs to be more idiomatic

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2024-03-30 15:17:10 +01:00