Sylvestre Ledru
0882eea07c
cksum/hashsum: factor the error structure and use it more
2024-05-29 09:08:04 +02:00
Sylvestre Ledru
dbe7a20e08
cksum/hashsum: refactor the common code.
...
Summary of the change:
* Move the common code into checksum
* Create a structure HashAlgorithm to handle the algorithm (instead of the 3 variables)
* Use the same function for cksum & hashsum for --check (perform_checksum_validation)
* Use the same for function for the hash generation (digest_reader)
* Add unit tests
* Add integration tests
* Fix some incorrect tests
2024-05-29 09:08:00 +02:00
Daniel Hofstetter
8d3181fed5
df: fix incorrect test & add another test
2024-05-27 11:53:12 +02:00
Sylvestre Ledru
09e53f3d2d
tests: fix some clippy warnings
2024-05-25 09:06:16 +02:00
Christian von Elm
0d1bde2879
tr: disallow classes besides [:upper:]/[:lower:] in set2 when translating
...
Fixes issue #6342
2024-05-23 22:06:57 +02:00
Walid
ebcd86df07
env: adds --ignore-signal ( #6377 )
...
* env: adds --ignore-signal
This commit implement #6164 .
* env: handle STOP signal and fix styling issue
* env: fix encoded bytes
* env: adds SAFETY comment and handle special signals in ignore_signal
* env: fix parsing to have compatible behaviour
* env: remove derive from Options
* env: changed safety comment, handle duplications after parsing and non-unix cfg
* env: adds tests for ignore-signal parsing and invalid and special signals
* env: change signal values to be non-constant
* env: adds testing for signal ignoring
* env: styling and remove unix specific derive
* test_env: add SIGSTOP to cspell workspace wordlist
* env: makes signal handling unix specific
* env: make ignore-signal function invocation unix specific
* test_env: make signal vector use slices ref instead of vec (linter)
* env: makes ignore-signal in options unix specific
* test_env: add unix specific import
2024-05-23 22:01:39 +02:00
Daniel Hofstetter
a816960c33
tests: remove 'target_pointer_width = "128"'
2024-05-20 23:27:53 +02:00
sreehari prasad
f2f4a424de
cp: parent-perm-race gnu fix ( #6403 )
2024-05-20 08:17:17 +02:00
sreehari prasad
3c096ee6ac
util: added umask manipulation ( #6404 )
...
Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
2024-05-19 21:56:41 +02:00
sreehari prasad
2e16cbbd7a
cp: link-deref gnu test fix ( #6378 )
...
Co-authored-by: Ben Wiederhake <BenWiederhake.GitHub@gmx.de>
2024-05-19 10:14:29 +02:00
Ben Wiederhake
b718f954e8
Merge pull request #6390 from sylvestre/cksum-check
...
cksum: implement check (Closes : #5705 )
2024-05-18 23:46:58 +02:00
Sylvestre Ledru
3156ad8298
Merge pull request #6412 from sylvestre/hashsum-fix
...
hashsum: improve the blake2 --tag export
2024-05-18 16:34:43 +02:00
Sylvestre Ledru
a9a11f486e
hashsum: rename the blake2b algo with --tag + manage the different length
2024-05-18 16:16:26 +02:00
Sylvestre Ledru
514d810371
cksum: improve the blake2b detection algo corner case
2024-05-17 22:09:41 +02:00
Sylvestre Ledru
db58d2b6b5
cksum: when length/bits can't be divided by 8, generate an error
2024-05-17 22:08:53 +02:00
Sylvestre Ledru
1b78102a6b
cksum: fails in case of unknown algo
2024-05-17 20:21:14 +02:00
Sylvestre Ledru
9c52ca8d55
cksum: also handle the case when the line start with ' \'
2024-05-15 11:46:58 +02:00
Dorian Péron
105024e708
ls: Fix quoting alignment
2024-05-15 09:59:38 +02:00
Dorian Péron
147c0b6962
tests(ls): Test space alignment when quoting is involved on grid output
2024-05-15 09:59:38 +02:00
Dorian Péron
0209c90b4e
tests(ls): Test default quoting style on TTY output
2024-05-15 09:59:38 +02:00
Sylvestre Ledru
58c2b5d421
cksum: add failing tests - to be fixed
2024-05-14 23:27:50 +02:00
Sylvestre Ledru
115b203b22
cksum: also show the error on stdout
2024-05-14 23:27:50 +02:00
Sylvestre Ledru
07d579c40a
cksum: handle the empty lines (and just spaces)
2024-05-14 23:27:50 +02:00
Sylvestre Ledru
bbd80e4061
cksum: various improvements/fixes
2024-05-14 23:27:47 +02:00
Sylvestre Ledru
843275a136
cksum/blake2b: improve the error management
2024-05-14 23:21:56 +02:00
Sylvestre Ledru
8ddb2131df
cksum/blake2b, when length=512, don't add it in the line
2024-05-14 23:21:56 +02:00
Sylvestre Ledru
1aec8b407d
chksum: add support of --check --algorithm=xxx
2024-05-14 23:21:56 +02:00
Sylvestre Ledru
81500ae3b8
cksum: implement check & strict
2024-05-12 21:20:58 +02:00
Daniel Hofstetter
320bdcf29e
tail: remove useless use of vec! in test
2024-05-12 15:32:24 +02:00
Daniel Hofstetter
692cdfac34
cp/tail: use #[ignore] to disable tests
...
instead of a cfg attribute
2024-05-12 15:15:44 +02:00
Anirban Halder
1a5639b7d2
Fix ls: panicking on dangling symlink with --color=auto -l ( #6346 )
...
* Fixed unwrap being called on dereferenced dangling symlink
* Added test
* Switched to regex matching in test
* Remove unnecessary mkdir call
* Modified documentation of the test and added assertion of the colors
* Fixed a typo
2024-05-11 21:07:44 +02:00
Jadi
9303f8e5b1
Disabling compare_xattrs cp and mv related tests on OpenBSD
...
The test_cp and test_mv have xattr related tests. They should
be disabled on OpenBSD after commit 19d42c0339
disabled the
compare_xattrs function on OpenBSD.
Fixes #6348
2024-05-09 18:24:39 +02:00
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
Sylvestre Ledru
421f3a9371
Merge pull request #6349 from jadijadi/disabling-xattrs-openbsd
...
Disabling xattrs tests on OpenBSD
2024-05-05 21:52:16 +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
Jadi
19d42c0339
Disabling xattrs function and tests on OpenBSD
...
The test_compare_xattrs test fails on OpenBSD because OpenBSD does
not support xattrs. Disabling this function and its test for
target_os = openbsd resolves the issue.
Fixes #6348
2024-05-05 09:08:35 +03:30
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
Daniel Hofstetter
7ac5595cdc
Merge pull request #6279 from BenWiederhake/dev-fix-multicall-test-precondition
...
tests: fix multi-call test precondition
2024-04-28 14:20:56 +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
Ben Wiederhake
d5b79329ad
tests: fix multi-call test precondition
...
This bug was introduced in de37baaf83
.
2024-04-27 16:12:01 +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
Sylvestre Ledru
9a6e0b7bef
Merge pull request #6198 from BenWiederhake/dev-better-test-coverage
...
tests: test multi-call logic
2024-04-25 08:11:00 +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
Ben Wiederhake
de37baaf83
tests: test multi-call logic
...
Thankfully, this revealed no bugs. Let's prevent regressions!
2024-04-07 01:35:57 +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
Daniel Hofstetter
eca8bafcc1
Merge pull request #6147 from sylvestre/tail-pid
...
tail: allow multiple usage of --pid to match upstream (regression of …
2024-03-30 14:07:33 +01:00
Michael Vogt
b703ec8795
tests: fix formating of test_touch.rs
...
Thanks to Sylvestre!
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2024-03-30 12:31:07 +01:00
Michael Vogt
a2f8084d48
tests: fix deprecation warning timestamp_subsec_nanos()
...
When building coreutils I got the following deprecation warning:
```
warning: use of deprecated method `chrono::NaiveDateTime::timestamp_subsec_nanos`: use `.and_utc().timestamp_subsec_nanos()` instead
--> tests/by-util/test_touch.rs:37:59
|
37 | ..._utc().timestamp(), tm.timestamp_subsec_nanos())
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
warning: `coreutils` (test "tests") generated 1 warning
```
This commit fixes it.
2024-03-30 11:17:22 +01:00
Daniel Hofstetter
28f7d56f6d
Merge pull request #6146 from sylvestre/mktemp
...
mktemp: adjust the error message to match 9.5
2024-03-30 08:12:15 +01:00
Sylvestre Ledru
f0286eb77d
tail: allow multiple usage of --pid to match upstream (regression of 9.5)
...
tested by tests/tail/pid
2024-03-30 07:28:31 +01:00
Sylvestre Ledru
ee198126af
mktemp: adjust the error message to match 9.5
2024-03-29 21:52:48 +01:00
Ben Wiederhake
e9045be593
tr: fix order inside class [:blank:]
2024-03-29 00:55:34 +01:00
Ben Wiederhake
76a2f2128b
tr: guard against regressions of class [:space:]
2024-03-29 00:50:33 +01:00
Sylvestre Ledru
2d7fa36aef
Merge pull request #6106 from sargas/fmt-negative-widths
...
fmt: allow negative widths as first argument
2024-03-25 13:43:54 +01:00
Terts Diepraam
d060134d97
uniq
: print version and help on stdout again (#6123 )
...
* uniq: print version and help on stdout again
* uniq: format test
* uniq: replace redundant closure with fn
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-03-25 09:40:36 +01:00
Terts Diepraam
e4a1455af5
Merge pull request #6114 from BenWiederhake/dev-csplit-repeated-args
...
csplit: Handle repeated args, fix remainder after error
2024-03-25 09:27:06 +01:00
Joseph Jon Booker
7b928f792c
fmt: allow negative widths as first argument
...
Also fix error messages for consistency with GNU fmt
2024-03-24 20:59:53 -05:00
Daniel Hofstetter
6f07bf10a1
Merge pull request #6112 from BenWiederhake/dev-comm-all-args
...
comm: Handle duplicated flags and output-delimiter correctly
2024-03-24 16:39:05 +01:00
Ben Wiederhake
388021833e
factor: correctly handle repeated flag
2024-03-24 00:07:08 +01:00
Ben Wiederhake
884ef1f54b
comm: implement and test correct handling of repeated flags
2024-03-23 23:35:40 +01:00
Ben Wiederhake
801edbbcb4
comm: implement and test correct handling of repeated --output-delimiter
2024-03-23 23:35:40 +01:00
Ben Wiederhake
1fa0b032e5
comm: permit and test separators that contain a hyphen
2024-03-23 23:35:40 +01:00
Ben Wiederhake
27fd3e5d39
csplit: do not emit remainder of input after an error
2024-03-23 23:21:53 +01:00
Ben Wiederhake
44fa2e960a
csplit: correctly handle repeated arguments
2024-03-23 23:21:53 +01:00
Sylvestre Ledru
ff1ecf6242
Merge pull request #6108 from BenWiederhake/dev-truncate-reference-create
...
truncate: correctly handle file (non-)creation
2024-03-23 18:46:16 +01:00
Ben Wiederhake
a1ad751aa9
truncate: deduplicate fifo check, fix handling of missing files
...
The fifo check used to include 'metadata(filename)?', which would error
if the file does not exist. In our case however, this is not an error.
2024-03-23 17:50:39 +01:00
Ulrich Hornung
066032b1d3
apply different reference sizes for f2fs (android) case
2024-03-23 16:54:19 +01:00
Ben Wiederhake
a3ab064f35
truncate: don't error in --no-create with reference case
2024-03-23 13:57:16 +01:00
Ben Wiederhake
4fcf912c85
truncate: remove two-year-old file-creation todos
...
In commit 129cfe12b8
2024-03-23 13:57:15 +01:00
Sylvestre Ledru
cf3fe0e566
shred: small improv on the tests
2024-03-23 12:22:32 +01:00
Sylvestre Ledru
bb5111cc71
shred: fails in case of permissions issue
2024-03-23 12:22:32 +01:00
Sylvestre Ledru
f410d0967f
shred: if the file is empty, don't run passes on it
2024-03-23 12:22:32 +01:00
Sylvestre Ledru
88ff42e840
Merge pull request #6102 from Krysztal112233/main
...
lint: fix lints of new Rust version
2024-03-23 12:21:03 +01:00
Krysztal112233
29d14cba51
lint: fix unused_imports
on freebsd target.
2024-03-23 17:23:22 +08:00
Krysztal112233
a61761f090
util: fix compile failed on Windows.
...
Use `std::path::MAIN_SEPARATOR_STR` instead of `std::path::MAIN_SEPARATOR`
2024-03-23 17:13:07 +08:00
Krysztal112233
6f5dfa3c46
lint: fix unused_imports
of util.rs
2024-03-23 17:02:32 +08:00
Krysztal112233
1484d06887
lint: fix clippy::manual_main_separator_str
for util.rs
on Windows cfg.
2024-03-23 16:56:43 +08:00
Krysztal112233
d21dc125d0
lint: fix clippy::suspicious_open_options
of project.
2024-03-23 16:49:35 +08:00
Daniel Hofstetter
5e6fa49ef5
more: fix incorrect tests
2024-03-22 15:13:53 +01:00
Krysztal112233
ef8c379370
lint: fix clippy::redundant_clone
of test_dd.rs
test_cp.rs
2024-03-22 17:38:54 +08:00
Krysztal112233
fd3640482b
lint: fix clippy::unnecessary_to_owned
in test_cksum.rs
2024-03-21 23:56:40 +08:00
Krysztal112233
ee09f276a4
lint: fix clippy::useless_format
in test_cksum.rs
2024-03-21 23:55:36 +08:00
Daniel Hofstetter
77a67559eb
Merge pull request #5966 from Ideflop/more-implement-argument-pattern
...
More implement argument pattern
2024-03-21 10:51:31 +01:00
Ulrich Hornung
89110abe97
test_od - re-enable f16 test with newer AVD system image
2024-03-20 23:33:06 +01:00
Daniel Hofstetter
3ad226cf54
fmt: show error if goal > default width
2024-03-20 10:26:11 +01:00
sreehari prasad
660014e532
dd: misc gnu test ( #6084 )
...
* dd: check file is a dir for iflag directory
* Improve english
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* dd: stderr output checking for "iflag directory" testcase
* dd: replace #[cfg(unix)] with #[test]
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-03-20 06:55:54 +01:00
Sylvestre Ledru
08172c28c0
Merge pull request #5801 from cre4ture/feature/env_string_args_try_with_shell_words
...
env: support string args by "-S", "-vS" or "--split-strings"
2024-03-19 19:32:04 +01:00
Daniel Hofstetter
7c8dfca4a7
Merge pull request #6094 from sargas/fmt-small-widths
...
fmt: Make sure goal is always positive
2024-03-19 16:55:10 +01:00
Joseph Jon Booker
f456b9531f
fmt: Make sure goal is always positive
...
A debug assertion was added to enforce "width >= goal" to catch
that case before a panic in linebreak.rs. A few warnings in linebreak.rs
were addressed as well, and some isize's that should always be positive
(if there's no width/goal bugs) were changed to usizes to catch bugs
earlier.
test_fmt_width is updated to test for the same result as GNU fmt
2024-03-19 08:52:04 -05:00
Ulrich Hornung
c62ba559d0
env: support string args by "-S", "-vS" or "--split-strings"
2024-03-19 00:45:05 +01:00
Ben Wiederhake
133cdde885
cksum: implement and test --base64 output method
2024-03-18 20:59:59 +01:00
Ben Wiederhake
7b219aee63
cksum: implement trivial --tag flag
2024-03-18 20:59:59 +01:00
Ben Wiederhake
edb1eb0a76
cksum: allow repeated flags and arguments
2024-03-18 20:59:59 +01:00
Daniel Hofstetter
2f4969c0e9
Merge pull request #6090 from sylvestre/csplit2
...
csplit: adjust the error message to match GNU's
2024-03-18 09:33:54 +01:00
Sylvestre Ledru
696615099c
Merge pull request #6088 from cre4ture/fix/gnu_test_dd_not_rewound_sh
...
`dd` fix gnu test `not-rewound.sh`
2024-03-17 23:03:22 +01:00
Ulrich Hornung
40577177b2
re-use existing fd for stdout even if its a seek-able file
...
this is important as the fd holds the file offset we need to use
2024-03-17 20:46:49 +01:00
Sylvestre Ledru
b49fbd9a21
csplit: run the file check before the arguments verifications
2024-03-17 19:09:34 +01:00
Sylvestre Ledru
8551c55ab3
csplit: adjust the error message to match GNU's
...
Should fix tests/csplit/csplit
2024-03-16 22:21:44 +01:00
Daniel Hofstetter
6d8b21da80
Fix two "item x is imported redundantly" warnings
2024-03-15 14:53:00 +01:00
Sylvestre Ledru
62a3fb8d3f
Merge pull request #5909 from cakebaker/split_fix_error_message_if_file_doesnt_exist
...
split: fix error message shown if file doesn't exist
2024-03-13 17:41:56 +01:00
Sylvestre Ledru
f89cfe2a5e
Merge pull request #6061 from cre4ture/fix/flaky_timeout_kill_subprocess
...
Fix/flaky timeout kill subprocess
2024-03-13 11:13:09 +01:00
Daniel Hofstetter
09adf77503
sort: fix incorrectly placed "}" in test
2024-03-13 07:19:42 +01:00
Ulrich Hornung
7e22f99913
remove second sh process to have timeout waiting for the right process
2024-03-12 19:08:51 +01:00
Ulrich Hornung
a2a375d0dd
using other than TERM/KILL signal to see if --preserve-status works
2024-03-12 19:05:51 +01:00
Sylvestre Ledru
1725479c06
hashsum: also escape/unescape files with checks ( #5868 )
...
* hashsum: make tag conflicts with --text and --check
* hashsum: change the case in one of the gnu test
* build-gnu.sh: use symlink instead of copy
Plus: it won't cp new md5
* hashsum: also escape/unescape files with checks
Should fix tests/cksum/md5sum-bsd.sh
* improve the variable name
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* Improve test
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
* Improve test
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-03-12 14:56:27 +01:00
Daniel Hofstetter
c619dbc99c
split: fix error msg shown if file doesn't exist
2024-03-12 14:28:25 +01:00
Sylvestre Ledru
ffb70592ec
Merge pull request #5851 from cre4ture/fix/install_invalid_link_at_destination
...
Fix install: invalid link at destination
2024-03-12 08:02:18 +01:00
Ulrich Hornung
7cd754eb1f
Fix install: invalid link at destination
...
also remove some FixMEs for FreeBsd
2024-03-11 23:31:26 +01:00
Sylvestre Ledru
89b326fe1e
cp: improve the support of --attributes-only ( #6051 )
...
* cp: improve the support of --attributes-only
* remove useless comments
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-03-11 08:35:27 +01:00
Sylvestre Ledru
80702d5391
Merge pull request #6014 from BenWiederhake/dev-shuf-range-off-by-one
...
shuf: Fix off-by-one errors in range handling
2024-03-10 22:44:12 +01:00
Sylvestre Ledru
2e8f0e501c
Merge pull request #6039 from BenWiederhake/dev-chcon-repeat-args
...
chcon: Handle repeated flags and overrides between --no-XXX and --XXX
2024-03-10 22:36:57 +01:00
Yury Zhytkou
156d3f7ee7
cut: allow non utf8 characters for delimiters ( #6037 )
2024-03-10 22:36:17 +01:00
Ideflop
a227af70bc
test/more: test argument --pattern
2024-03-10 22:14:26 +01:00
Daniel Hofstetter
0579233b2d
chgrp: fix clippy warning
2024-03-10 13:56:31 +01:00
Daniel Hofstetter
9054a24fb7
pr: fix deprecation warnings & remove comment
2024-03-10 13:55:49 +01:00
Daniel Hofstetter
1eaa87cd62
Merge pull request #6052 from sylvestre/clippy43
...
Fix clippy warnings
2024-03-10 13:31:08 +01:00
Terts Diepraam
a578fe9e55
Merge pull request #6050 from matrixhead/main
...
dd : treat arg as bytes if it contains a 'B'
2024-03-10 12:52:29 +01:00
Yash Thakur
d11d595fda
touch: Respect -h when getting metadata ( #5951 )
...
* Add tests that stat symlinks
* Check follow first in stat
* Don't run tests on FreeBSD
It would be possible to get them to run on FreeBSD by avoiding
get_symlink_times, but the behavior we're testing is not
platform-specific, so it's fine to not test it on FreeBSD.
---------
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2024-03-10 08:05:59 +01:00
Sylvestre Ledru
8c7940260b
Merge pull request #6047 from cakebaker/bump_chrono
...
Bump chrono to 0.4.35 & replace usage of deprecated functions
2024-03-10 07:51:50 +01:00
Ben Wiederhake
8be5f7a89d
chcon: allow repeated flags and arguments
2024-03-09 22:52:55 +01:00
Ben Wiederhake
dbfd4d80ee
chcon: allow overriding between --dereference and --no-dereference
2024-03-09 22:52:55 +01:00
Ben Wiederhake
b233569b9c
shuf: fix error message text on negative-sized ranges
...
Found by @cakebaker:
https://github.com/uutils/coreutils/pull/6011#discussion_r1501838317
2024-03-09 22:51:13 +01:00
Ben Wiederhake
4ee3f68e6a
shuf: fix and test off-by-one errors around ranges
2024-03-09 22:51:13 +01:00
Sylvestre Ledru
6c29ed037b
Merge pull request #6042 from BenWiederhake/dev-chown-preserve-root
...
chown+chgrp+chmod: Fix handling of preserve root flag and error messages
2024-03-09 22:44:59 +01:00
Sylvestre Ledru
dcfb03aad6
Fix clippy warnings
2024-03-09 22:31:33 +01:00
mhead
1819cdee3b
dd: treat arg as bytes if it contains 'B'
2024-03-10 01:38:50 +05:30
Ulrich Hornung
db142f9449
use std::command::pre_exec() to set limits on child before exec
2024-03-08 20:30:34 +01:00
Ben Wiederhake
5c2c38c31e
chgrp+chown: also trigger preserve-root during dirwalking, fix error message
...
This is explicitly tested in the GNU tests.
2024-03-07 14:58:02 +01:00
Daniel Hofstetter
aad8f7d8b5
touch: replace use of deprecated chrono functions
2024-03-06 18:16:49 +01:00
Daniel Hofstetter
4d66af2f53
Merge pull request #6034 from BenWiederhake/dev-cat-flags-everything
...
cat: Handle all flags correctly
2024-03-04 10:57:55 +01:00
Daniel Hofstetter
679b9e2c0a
cat: prefix two test fns with "test_"
2024-03-04 09:41:09 +01:00
Daniel Hofstetter
d651063de3
tests/common/util.rs: add cfg(feature = "env")
2024-03-03 15:02:19 +01:00
Ben Wiederhake
cd70d7dec1
cat: ignore -u flag, just like GNU does
2024-03-01 23:56:30 +01:00
Ben Wiederhake
472b56f0ff
cat: fix -b and -n anti-symmetry
2024-03-01 23:56:30 +01:00
Ben Wiederhake
100a48fda9
cat: permit repeating command-line flags
2024-03-01 23:56:30 +01:00
Sylvestre Ledru
9003e3fbe4
Merge pull request #5869 from cre4ture/feature/simulate_terminal_utility
...
test utilities: easy way to simulate terminal context
2024-03-01 18:13:27 +01:00
Ben Wiederhake
ba1c6b0044
cp: fix flaky test test_cp_arg_interactive_update, document adjacent bug
2024-03-01 11:41:22 +01:00
Dorian Péron
58ee0ce427
tests/printf: Verify the correct error behavior of printf when provided with '%0c' or '%0s'
2024-03-01 00:02:31 +01:00
Dorian Péron
42cde767d2
printf: Change get_char and write_padded to handle bytes instead of chars
2024-02-29 00:59:08 +01:00
Dorian Péron
5d74a6e002
tests/printf: Fix char_as_byte test, add char and string padding tests
2024-02-29 00:43:47 +01:00
Sylvestre Ledru
769c5ca7a5
Merge pull request #6000 from BenWiederhake/dev-pipein-fails-flake
...
tests: Harden two tests, prevent 4 flaky tests (cat, numfmt, sort, split, tee)
2024-02-28 09:41:00 +01:00
Daniel Hofstetter
aa0d15d1ac
Merge pull request #6011 from BenWiederhake/dev-shuf-repeat-zero-items
...
shuf: Refuse repeating zero lines
2024-02-27 15:28:06 +01:00
Daniel Hofstetter
ae7d03cb15
Merge pull request #6007 from BenWiederhake/dev-basexx-multi-arg
...
base32/base64/basenc: implement and test proper flag parsing
2024-02-27 15:03:47 +01:00
Sylvestre Ledru
56e26f72b5
Merge pull request #6022 from cakebaker/uniq_use_concat
...
uniq: use `concat!` in tests for better readability
2024-02-27 13:09:21 +01:00
Daniel Hofstetter
8b2a2921c5
Merge pull request #6018 from BenWiederhake/dev-basename-multi-arg
...
basename: Fix handling of repeated flags/arguments
2024-02-27 10:03:14 +01:00
Daniel Hofstetter
c85970485a
uniq: use concat! in tests for better readability
2024-02-26 16:37:01 +01:00
Daniel Hofstetter
d8e6f36fcb
Merge pull request #6017 from BenWiederhake/dev-uniq-flake-stdin-write-gnutest
...
uniq: Fix flaky test gnu_tests
2024-02-26 16:18:26 +01:00
Matei Mantu
095eced4be
chmod: Fix chmod -c --reference reporting when no change is made ( #6016 )
...
* Make fperm hold 6 digit octal permission. Set it to 4 digits when displaying
* Add test
* Make every permission 4 octal digits
* Change test name to be more suggestive
* chmod: merge two args in test
---------
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-02-26 11:01:50 +01:00
Ulrich Hornung
d8b3b41850
added configurable terminal size
2024-02-25 21:47:07 +01:00
Ben Wiederhake
f905d9ce41
basename: implement and test repeated flags and arguments
...
Note in particular that `args_override_self` would *NOT* work here,
since it would in all cases cause `options::NAME` to override itself,
or interfere with `trailing_var_arg`.
2024-02-25 19:45:32 +01:00
Ben Wiederhake
9441806a23
basename: test flag implications, document -z correctly
2024-02-25 19:14:17 +01:00
Ulrich Hornung
a4d5defeef
simulate terminal utility (squash)
2024-02-25 18:15:15 +01:00
Ben Wiederhake
e91d0bd14f
uniq: fix flaky test gnu_tests
...
The testcase tries to write to the stdin pipe while the process under
test is simultaneously exiting with an error code. Naturally, this is a
race, and we should ignore any stdin write errors. However, adding this
feature to the list makes it even more unreadable, and adds no real
value, so let's skip the input data entirely.
2024-02-25 17:59:09 +01:00
Ben Wiederhake
6834b593ee
shuf: refuse repeating zero lines
...
This was a GNU behavior bug:
```console
$ LC_ALL=C shuf -er
shuf: no lines to repeat
[$? = 1]
$ cargo run shuf -er # old, bad (unexpected success)
$ cargo run shuf -er # new
shuf: no lines to repeat
[$? = 1]
```
2024-02-25 16:49:03 +01:00
Terts Diepraam
d7a09c042a
Merge pull request #6010 from BenWiederhake/dev-pr-fix-flaky-diff-timestamp
...
pr: Check the correct timestamp in test_with_pr_core_utils_tests
2024-02-25 11:46:39 +01:00
Sylvestre Ledru
174864566e
Merge pull request #6006 from BenWiederhake/dev-tr-multi-arg
...
tr: Correctly handle multiple appearances of flag-args
2024-02-25 09:51:40 +01:00
Sylvestre Ledru
8301a8e5be
Merge pull request #5980 from BenWiederhake/dev-shuf-number-speed
...
shuf: Fix OOM crash for huge number ranges
2024-02-25 09:50:49 +01:00