Commit graph

2693 commits

Author SHA1 Message Date
Samuel Tardieu
47e908bc6c printf: output of double-quote should not be escaped
This is obtained by escaping the sequence `\"` as `"`.
2024-01-10 19:17:42 +01:00
Sylvestre Ledru
19a9380089
Merge pull request #5803 from D9nni/cksum
cksum: Add --raw argument
2024-01-10 18:36:08 +01:00
Samuel Tardieu
7d32e49fb9 printf: %c prints the first byte of its argument 2024-01-10 18:19:56 +01:00
Marras Antoine
3b884966ac printf: added failing tests on alternative hex form 2024-01-10 16:55:03 +01:00
Samuel Tardieu
a85a792c88 format: use the new number parser and fix the error messages
The error messages are more compliant with GNU coreutils.
Also, floating hexadecimal numbers are now supported in
`printf`.
2024-01-10 14:34:43 +01:00
D9nni
96271ffa3c cksum: added tests for --raw with each algorithm, not working for crc, sysv, bsd 2024-01-09 23:12:40 +02:00
Daniel Hofstetter
f400a07dc6 pathchk: remove useless comments 2024-01-09 15:19:22 +01:00
Daniel Hofstetter
49154669a6 pathchk: simplify and rename test 2024-01-09 15:17:15 +01:00
Samuel Tardieu
5dfeca9ff2 format: %c prints the first character of a string 2024-01-09 00:13:54 +01:00
Sylvestre Ledru
294a0abb9c
Merge pull request #5812 from cakebaker/ln_fix_unused_import_on_android
ln: fix "unused import" warning on Android
2024-01-08 18:05:10 +01:00
Daniel Hofstetter
e29afdc0df head: disable some tests on Android 2024-01-08 17:29:34 +01:00
Daniel Hofstetter
62dffc3250 ln: fix "unused import" warning on Android 2024-01-08 17:17:43 +01:00
D9nni
28b5224725 cksum: fixed test for --raw on single file 2024-01-08 15:50:25 +02:00
Daniel Hofstetter
1c6bf6991c nl: don't exit if input is directory 2024-01-08 11:01:07 +01:00
Sylvestre Ledru
d72343bc64
Merge branch 'main' into cksum 2024-01-08 09:02:11 +01:00
D9nni
f03ef79bc8 cksum: added tests for --raw and fixed fmt whitespace error 2024-01-08 08:51:06 +02:00
Atomei Alexandru Constantin
0bfd4bbdf7 Added test to validate that it now generates the error for an arbitrary directory 2024-01-08 00:08:24 +02:00
Sylvestre Ledru
b309d64e78
Merge branch 'main' into issue-5766 2024-01-06 22:55:54 +01:00
Kostiantyn Hryshchuk
c867d6bfb1
shred: implemented "--remove" arg (#5790) 2024-01-06 22:50:21 +01:00
Sylvestre Ledru
247f2e55bd
seq: adjust some error messages. GNU's are better (#5798)
* seq: adjust some error messages. GNU's are better
tested by tests/seq/seq.pl

* uucore: remove todo

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2024-01-06 16:54:29 +01:00
Daniel Hofstetter
e13f0d80ee
Merge pull request #5778 from RenjiSann/main
ls: Support QUOTING_STYLE environment variable
2024-01-05 15:55:23 +01:00
Samuel Tardieu
32f0256d7d uucore/num_format: properly display 10ᵖ where p is the precision
`seq --format %.2g 10 10` would display `1` because the precision would
not allow room for the decimal point, and the `0` in `10` would be
trimmed as an insignificant trailing `0`.

This has been fixed by only trimming trailing `0` in the presence of a
decimal point.
2024-01-05 15:40:20 +01:00
Dorian Péron
4372908e84 fix: cargo fmt + fix spelling mistake 2024-01-05 13:55:47 +01:00
Sylvestre Ledru
aabf5fa577 cp: manages target with trailing '/' 2024-01-05 12:56:27 +01:00
Sylvestre Ledru
4c698d58e0 mv: support the case mkdir a && mv a e/ 2024-01-05 12:56:24 +01:00
Dorian Péron
c58575edaa tests/ls: Add tests to ensure env var is used as a last resort 2024-01-05 02:10:33 +01:00
cre4ture
9b3cc5437c
head: head_backwards for non-seekable files like /proc/* or fifos (named pipes) (#5732)
* implement head_backwards for non-seekable files like /proc/* or pipes

Signed-off-by: Ulrich Hornung <hornunguli@gmx.de>
2024-01-05 00:25:59 +01:00
Daniel Hofstetter
e4fbc31714 du: ignore duplicate names with --files0-from 2024-01-03 09:39:16 +01:00
Daniel Hofstetter
239e5426e6 du: show error for nul names with --files0-from 2024-01-02 16:06:41 +01:00
Daniel Hofstetter
7ddeba4b98 cp: show no "same file" error for --link a a 2024-01-01 14:30:27 +01:00
Daniel Hofstetter
5673f32c63 cp: show error if source & dest are same file 2023-12-31 16:01:34 +01:00
Daniel Hofstetter
2c42623b6e cp: backup dest symlink linking to source 2023-12-31 14:09:08 +01:00
Sylvestre Ledru
193bcf86b7 cp: Disable a test failing on freebsd 2023-12-30 17:00:44 +01:00
Vardhan Patil
1fc6a760f3 tests/cksum: fix formatting 2023-12-30 20:31:52 +05:30
Vardhan Patil
e1863ac64e tests/cksum: test when the --length argument is 0 or >512 2023-12-30 20:14:30 +05:30
Vardhan Patil
09ef150085 tests/cksum: add tests for the length argument 2023-12-30 16:01:22 +05:30
Daniel Hofstetter
7025619325 cp: adapt warning if source is used more than once 2023-12-29 10:24:08 +01:00
Daniel Hofstetter
9bb725cefc clippy: fix warnings introduced by Rust 1.75 2023-12-28 18:17:06 +01:00
Sylvestre Ledru
d82ee771aa install: Add a test to cover recent changes 2023-12-28 16:34:09 +01:00
Sylvestre Ledru
764ea34c37 dd/chroot: improve the skip message (not root) 2023-12-28 00:44:19 +01:00
Daniel Hofstetter
0701f535ac cp: fix backup of destination symlink 2023-12-27 15:39:54 +01:00
Matei Mantu
bf26eda786
install: remove / from end of path if it exists so as not to mess with .exists() (#5730)
* remove / from end of path if it exists so as not to mess with .exists()

* install: fix / removal from path

* Fix clippy warnings

* Add test for install target ends with /
2023-12-27 13:37:17 +01:00
Sylvestre Ledru
e26f4c7f36
Merge pull request #5727 from cakebaker/du_simplify_file_creation_in_tests
du: simplify file creation in tests
2023-12-26 16:12:52 +01:00
Sylvestre Ledru
167acb5147
Merge pull request #5484 from cakebaker/cp_l_with_dest_hardlink_to_source
cp --link: don't fail if destination is hardlink to source
2023-12-26 16:12:15 +01:00
Daniel Hofstetter
2d260ded58 du: use concat! to improve readability in tests 2023-12-26 15:19:45 +01:00
Daniel Hofstetter
37c83ec480 du: simplify file creation in tests 2023-12-26 15:15:02 +01:00
Sylvestre Ledru
30eb77ac79
du: implement files0-from (#5721)
* du: implement files0-from

Should make tests/du/files0-from-dir pass

* du: prepare tests/du/files0-from.pl

* fix the build on Windows

* add testfile to the ignore list

* remove useless comment

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

* mkdir is enough

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

* address review comments

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-12-26 14:40:31 +01:00
Sylvestre Ledru
6d2486c096
Merge pull request #5503 from cakebaker/du_unused_du_basics
du: call unused _du_basics() in test_du_basics()
2023-12-25 22:38:27 +01:00
Sylvestre Ledru
0fb4d8843c
Merge pull request #5455 from n1000/freebsd_fixes_push_3
tests/test: Ensure the test fixture files have the expected gid
2023-12-25 22:03:15 +01:00
Sylvestre Ledru
db9f4cc315
Merge pull request #5483 from cakebaker/mv_fix_5481
mv: fix subdir detection
2023-12-25 22:02:23 +01:00
Sylvestre Ledru
628819701d
Merge pull request #5530 from cakebaker/du_test_posixly_correct
du: test behavior with POSIXLY_CORRECT set
2023-12-25 22:01:25 +01:00
Daniel Hofstetter
f10c6f1d56
Merge pull request #5699 from sylvestre/mv-cp-seen
cp/mv/ln: add support for the "will not overwrite just-created"
2023-12-25 14:58:50 +01:00
Daniel Hofstetter
030fd3d4d2 du: test behavior with POSIXLY_CORRECT set 2023-12-25 13:17:17 +01:00
Daniel Hofstetter
03f1b8aa3a mv: fix subdir detection 2023-12-25 13:12:18 +01:00
Nathan Houghton
1915e3c438 tests/test: Ensure the test fixture files have the expected gid
On some platforms (mostly the BSDs) the test fixture files copied to the
/tmp directory will have a different gid than the current egid (due to
the sticky bit set on the /tmp directory). Fix this before running the
"test" command.
2023-12-25 13:10:22 +01:00
Daniel Hofstetter
4946478409 cp: -l don't fail if dest is hardlink to source 2023-12-25 13:03:11 +01:00
Sylvestre Ledru
356023b055
Merge pull request #5431 from cakebaker/cp_remove_destination_shouldnt_fail_hardlink
cp --remove-destination: don't fail if destination is hardlink to source
2023-12-25 13:02:50 +01:00
Daniel Hofstetter
863c022352
Merge pull request #5723 from sylvestre/tee-warning
tee test: fix a warning on not(linux)
2023-12-25 11:47:13 +01:00
Sylvestre Ledru
6ce9d84232
Merge pull request #5532 from cakebaker/df_fix_5531
df: fix rounding issue in test
2023-12-25 11:23:48 +01:00
Sylvestre Ledru
60d71e3f2a ln: disable a test on android 2023-12-25 11:22:04 +01:00
Sylvestre Ledru
f86e314f46 Fix some obvious comment
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-12-25 11:17:04 +01:00
Sylvestre Ledru
840a5bf083
Merge pull request #5700 from cakebaker/ls_block_size_with_k
ls: set correct block size when -k is provided
2023-12-25 11:14:09 +01:00
Sylvestre Ledru
853f73b7c9 tee test: fix a warning on not(linux)
warning: unused import: `std::fmt::Write`
2023-12-25 11:06:24 +01:00
Daniel Hofstetter
270ac90cc1 ls: set correct block size when -k is provided 2023-12-24 16:35:49 +01:00
Sylvestre Ledru
0220353c4c
test_install.rs: Remove a debug artifact 2023-12-24 15:26:38 +01:00
Sylvestre Ledru
15573579cc Fix the windows tests 2023-12-24 15:18:31 +01:00
Sylvestre Ledru
6b8f71116d
Merge pull request #5717 from cakebaker/wc_android
wc: disable part of test on Android
2023-12-24 14:52:08 +01:00
Daniel Hofstetter
4d05f208e0
Merge pull request #5701 from sylvestre/debug
cp: debug with --update=none should show 'skipped'
2023-12-24 14:25:57 +01:00
Daniel Hofstetter
df492d34cb wc: disable part of test on Android 2023-12-24 13:20:57 +01:00
Sylvestre Ledru
8685e05f4e cp: debug with --update=none should show 'skipped' 2023-12-23 17:58:05 +01:00
Daniel Hofstetter
be822009f0
Merge pull request #5686 from sylvestre/install-basic
install: with -t, check if we aren't passed a file
2023-12-23 15:33:45 +01:00
Sylvestre Ledru
2832694056
install: support when a hyphen is passed (#5697)
* install: support when a hyphen is passed

Should fix: tests/install/strip-program.sh

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-12-23 15:29:32 +01:00
Sylvestre Ledru
ceecac110c ln: manages the 'seen' file list before linking
Should help with tests/mv/childproof.sh
2023-12-23 13:53:26 +01:00
Sylvestre Ledru
c94773f522 mv: make sure it continues when hiting an error 2023-12-23 13:27:00 +01:00
Sylvestre Ledru
3af8ad0fe6 mv: manages the 'seen' file list before moving
Should help with tests/mv/childproof.sh
2023-12-23 13:07:39 +01:00
Sylvestre Ledru
06c98fbdd3 cp: don't fail when --backup=numbered is passed 2023-12-23 12:48:38 +01:00
Sylvestre Ledru
837640bc02 cp: manages the 'seen' file list before copying
Should help with tests/mv/childproof.sh
2023-12-23 12:11:35 +01:00
Sylvestre Ledru
6b1f51385f
Merge pull request #5693 from cakebaker/ls_second_blocksize
ls: introduce 2nd blocksize & fix todos in tests
2023-12-23 09:57:08 +01:00
Sylvestre Ledru
9ca7c3e107 install: with -t, check if we aren't passed a file
Should pass tests/install/basic-1
2023-12-22 18:16:23 +01:00
Daniel Hofstetter
1c6317af76 mv: allow dest with slash when using --update 2023-12-22 17:03:59 +01:00
Daniel Hofstetter
a8a5931cae ls: introduce 2nd blocksize & fix todos in tests 2023-12-22 11:42:01 +01:00
Sylvestre Ledru
e071fd3042
Merge pull request #5684 from allaboutevemirolive/v10_expand
expand: fix duplicate flags
2023-12-21 11:03:09 +01:00
Daniel Hofstetter
0164934afe df: fix rounding issue in test
Set block size to 1 so the returned values are the same values as
used for the calculation of the percentage values
2023-12-21 10:46:11 +01:00
Terts Diepraam
4b2577fc78 test/sort: run cargo fmt 2023-12-21 10:19:52 +01:00
allaboutevemirolive
f874788b2c Use better testcase 2023-12-21 10:48:58 +02:00
allaboutevemirolive
3e6187269e fix duplicate flags 2023-12-20 23:30:46 +02:00
Justin !
a6ba81db20
sort: allow -f to be pass multiple time
Fix #5667
2023-12-20 12:42:57 -05:00
Daniel Hofstetter
d8709d2839 ls: recognize BLOCKSIZE env var 2023-12-19 15:00:06 +01:00
Sylvestre Ledru
9920f13a34
Merge pull request #5640 from tertsdiepraam/tr-no-output
`tr`: operate on bytes instead of chars
2023-12-19 11:42:44 +01:00
Daniel Hofstetter
a5606613bd ls: ignore invalid block size from env vars 2023-12-19 10:02:34 +01:00
Sylvestre Ledru
52af36d80b
Merge pull request #5673 from tertsdiepraam/expr-fix-comparison
`expr`: coerce to string before comparing values
2023-12-18 22:50:42 +01:00
Terts Diepraam
00b9cbe09e expr: coerce to string before comparing values 2023-12-18 22:24:31 +01:00
Sylvestre Ledru
b32c93ee5e
Merge pull request #5672 from cakebaker/ls_hyperlink_dirs
ls: support hyperlinks for dir names
2023-12-18 18:24:27 +01:00
Sylvestre Ledru
ece9e91593
Merge pull request #5671 from Yykz/wc_args_override
wc: fix arguments not overriding
2023-12-18 15:56:10 +01:00
Yykz
652e02fb59 cargo fmt 2023-12-18 15:34:51 +01:00
Daniel Hofstetter
917c6a4743 ls: support hyperlinks for dir names 2023-12-18 15:26:09 +01:00
Yykz
cae113c237 Added tests 2023-12-18 14:12:59 +01:00
Sylvestre Ledru
0fa074fcba
Merge pull request #5629 from cakebaker/ls_hyperlink_encode
ls: encode path when using --hyperlink
2023-12-18 13:38:08 +01:00
Daniel Hofstetter
e79eb097af
Merge pull request #5656 from sylvestre/ls-var
ls: manages the COLOR and COLORTERM variables
2023-12-18 07:16:38 +01:00
Sylvestre Ledru
57cd69b466
Merge pull request #5639 from lcheylus/openbsd-fix
tests/hostname: disable failing test_hostname::test_hostname_ip on OpenBSD
2023-12-16 10:25:52 +01:00
Sylvestre Ledru
f6d3f9afbf ls: manages the COLOR and COLORTERM variables
Should fix GNU tests/ls/color-term.sh
2023-12-16 09:50:37 +01:00
Terts Diepraam
66bd065835
Merge pull request #5641 from cakebaker/ls_block_size_si_human_readable
ls: make --block-size and --human-readable/--si override each other
2023-12-14 17:04:34 +01:00
Daniel Hofstetter
6fb3bbb8a0 mv: rename two tests 2023-12-13 14:27:19 +01:00
Daniel Hofstetter
42558344f1 ls: enable "args override self" 2023-12-12 14:23:51 +01:00
Daniel Hofstetter
89cb4acb99 ls: encode path when using --hyperlink 2023-12-12 10:03:55 +01:00
Daniel Hofstetter
6711dd5694 ls: make --block-size and --human-readable/--si
override each other
2023-12-11 16:38:55 +01:00
Daniel Hofstetter
3dad5d4d56
Merge pull request #5635 from tertsdiepraam/fix-echo-override
`echo`: make `-e` and `-E` override each other
2023-12-11 14:21:15 +01:00
Terts Diepraam
bc5b5e013a tr: operate on bytes instead of chars 2023-12-11 13:35:17 +01:00
Laurent Cheylus
2faab59aa4
tests/hostname: disable failing test_hostname::test_hostname_ip on OpenBSD
- On OpenBSD, test_hostname::test_hostname_ip fails with "failed to lookup address information:
    Name does not resolve" error

Signed-off-by: Laurent Cheylus <foxy@free.fr>
2023-12-11 12:45:16 +01:00
Terts Diepraam
191eb9ac12 echo: make -e and -E override each other 2023-12-11 10:53:55 +01:00
Sylvestre Ledru
4442b35370
Merge pull request #5626 from cakebaker/ls_invalid_block_size
ls: handle invalid block size as GNU does
2023-12-11 07:49:38 +01:00
Dorian Péron
673093f842
ls: set default quoting style to literal when not TTY (#5553)
* ls: set default quoting style to literal if output is not TTY

* tests/ls: Fix quoting tests that now run with Literal as default

* ls: Fix formatting/linting/spelling issues

* tests/ls: Fix windows escaped tests
2023-12-10 16:07:41 +01:00
Sylvestre Ledru
1d4c919b97
Add mdir to the spell ignore 2023-12-09 16:33:19 +01:00
Sylvestre Ledru
e071286eb0 address review comments 2023-12-09 13:10:41 +01:00
Sylvestre Ledru
268b180416 ls colors: create a stylemanager to carry the previous style to know if we need to reset or not 2023-12-09 13:10:38 +01:00
Sylvestre Ledru
b676216f9b ls: use the gnu_legacy feature from lscolors 2023-12-09 13:05:12 +01:00
Daniel Hofstetter
e9dc2930ee ls: handle invalid block size as GNU does 2023-12-08 19:19:51 +01:00
Daniel Hofstetter
c111dc88ac du: fix issue with dereference in test 2023-12-08 10:23:15 +01:00
zhitkoff
967c539cc6 wc: more tests 2023-12-07 10:50:55 -05:00
zhitkoff
054ca4a6b5 wc: better handle files in pseudo-filesystems 2023-12-07 10:50:55 -05:00
Sylvestre Ledru
ca024abe31
Merge pull request #5554 from cakebaker/mv_no_target_directory
mv: fix issue with -T and destination ending with "/"
2023-12-07 14:13:06 +01:00
Sylvestre Ledru
fe730f8a49
Merge pull request #5611 from sylvestre/dirdb
dircolors: Move the static long string into structures.
2023-12-07 09:58:55 +01:00
Daniel Hofstetter
5a32ab8004 ls: implement --hyperlink 2023-12-07 08:14:25 +01:00
Sylvestre Ledru
80b1ccd665
Merge pull request #5609 from cakebaker/ls_ignore_value_of_posixly_correct
ls: ignore value of `POSIXLY_CORRECT`
2023-12-06 21:27:21 +01:00
Sylvestre Ledru
b0fdb1edef Rest of the comments 2023-12-04 23:39:10 +01:00
Sylvestre Ledru
dabbcff9fb dircolors: manage the --print-ls-colors pipe option 2023-12-04 22:41:03 +01:00
Terts Diepraam
35548e2137
Merge pull request #5615 from cakebaker/du_disable_test_on_android
du: disable test on Android
2023-12-03 16:58:00 +01:00
Daniel Hofstetter
51fc2d7564 ls: ignore value of POSIXLY_CORRECT 2023-12-03 16:01:19 +01:00
Daniel Hofstetter
49fb72ed21 du: disable test on Android 2023-12-03 14:07:03 +01:00
Nathan Houghton
0ea1a7cd88 tests/cp, tests/test: Don't attempt to set sticky file bit on FreeBSD
On FreeBSD (and OpenBSD), only the superuser can set the file sticky
bit.
2023-12-02 16:58:27 +01:00
Daniel Hofstetter
4903b91973 du: call unused _du_basics() in test_du_basics() 2023-12-02 16:52:12 +01:00
Sylvestre Ledru
e24d6b2fbd
Merge pull request #5604 from cakebaker/ls_fix_padding
ls: fix padding of size column when using `-l`
2023-12-02 09:40:18 +01:00
Daniel Hofstetter
6b3f00cc31 dd: skip two tests without "printf" feature 2023-12-01 10:03:44 +01:00
Piotr Kwiecinski
c6e7fdcabe skip test_cp_arg_update_interactive on FreeBSD 2023-11-30 18:45:06 +01:00
Daniel Hofstetter
0ec6802459 ls: fix padding of size column when using -l 2023-11-30 16:19:27 +01:00
Daniel Hofstetter
6eec4fe8f9 cut: add test & improve error message 2023-11-29 09:41:11 +01:00
Sylvestre Ledru
b5ce876fef
Merge pull request #5580 from zhitkoff/split-r-chunk
split: passing GNU test r-chunk.sh
2023-11-28 10:38:00 +01:00
Sylvestre Ledru
14a8e8a452
Merge pull request #5128 from tertsdiepraam/printf-rewrite
`printf` rewrite (with a lot of `seq` changes)
2023-11-28 07:52:58 +01:00
Sylvestre Ledru
88d63be3a0
Merge pull request #4545 from jfinkels/dd-reblock
dd: buffer partial blocks in the output writer
2023-11-27 09:31:36 +01:00
Jeffrey Finkelstein
ceccd2ecc6 dd: buffer partial blocks in the output writer
Add buffering of partial blocks in the output block writer until they
are completed.
2023-11-26 18:03:06 -05:00
zhitkoff
f8f6346126 wc: fix FilesDisabled error message 2023-11-25 18:16:34 -05:00
zhitkoff
7b2a3e236e split: r-chunk tests and infinite input 2023-11-25 11:12:08 -05:00
Sylvestre Ledru
64d47730bc
Merge pull request #5555 from cakebaker/cp_adapt_omitting_dir_msg
cp: improve error msg if -r is not specified
2023-11-24 21:51:04 +01:00
zhitkoff
4dc46f10e9 split: pass GNU test l-chunk 2023-11-24 10:06:16 +01:00
Coba Weel
7efe33108a Fix issue 5576 (regex matching bug in expr)
Issue 5576 reported a bug in expr, found by the fuzzer. The problem
turns out to be with the regex match operator `:`, which is defined in
POSIX and the GNU manual to match the pattern only when it occurs at
the beginning of the string, i.e., the regex has an implicit `^`
prepended to it. We hadn't been doing that.
2023-11-23 16:26:37 +01:00
Daniel Hofstetter
c2bfb6a465 expr: adapt error messages, revert most of #5559 2023-11-23 15:14:25 +01:00
Daniel Hofstetter
2e77d99dd4 expr: fail fast if there are no operands 2023-11-23 14:35:02 +01:00
Sylvestre Ledru
af021e0d4f
Merge pull request #5559 from pawelngei/expr-substr-error
expr: different stderr with `expr "56" "substr"`
2023-11-22 14:56:42 +01:00
Terts Diepraam
0822511fdc test/printf: ignoring rounding up to 2
This is a limitation of the current implementation, which should ultimately use "long double" precision instead of f64.
2023-11-21 16:49:20 +01:00
Zhuoxun Yang
44702940d2 tests/expr: check prefix operation 2023-11-21 22:06:20 +08:00
ALXD
8b650a7a9b expr: add tests for precise error messages 2023-11-21 10:14:24 +01:00
Terts Diepraam
6d2698b802 Merge branch 'main' into printf-rewrite 2023-11-20 13:53:11 +01:00
clara swanson
58087df02a
stdbuf: remove crash macro (#5549)
* stdbuf: remove crash! macro

* stdbuf: change target_vendor back to apple

* tests/stdbuf: change stderr_only to usage_error in test_stdbuf_invalid_mode_fails

* stdbuf: add exit code to check_option

* stdbuf: remove set_exit_code line from error
2023-11-20 10:16:18 +01:00
Daniel Hofstetter
285e580b6e cp: improve error msg if -r is not specified 2023-11-20 09:15:15 +01:00
Daniel Hofstetter
8e796d3bb6 mv: fix issue with -T and dest ending with "/" 2023-11-19 15:10:28 +01:00
Yury Zhytkou
eb00c195c6
split: pass GNU tests/b-chunk.sh (#5475)
---------

Co-authored-by: Terts Diepraam <terts.diepraam@gmail.com>
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
Co-authored-by: Brandon Elam Barker <brandon.barker@gmail.com>
Co-authored-by: Kostiantyn Hryshchuk <statheres@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-11-17 17:19:10 +01:00
Terts Diepraam
ce18e0ab97 printf: ignore hexadecimal floats test
This can be un-ignored when it is implemented
2023-11-17 14:47:41 +01:00
Terts Diepraam
fef84f7203 printf: add emoji character test 2023-11-17 14:47:08 +01:00
Terts Diepraam
955640aac8 printf: fix and test float formatting 2023-11-17 14:46:38 +01:00
Daniel Hofstetter
2f9fcf73fa clippy: fix warnings introduced by Rust 1.74 2023-11-16 16:21:28 +01:00
ALXD
3cdb0966ae printf: add a test for %x with invalid value 2023-11-15 17:51:43 +01:00
Daniel Hofstetter
12e61d451c du: make -l/--count-links work 2023-11-09 16:07:02 +01:00
Terts Diepraam
1cae4981e6
Merge pull request #5508 from cakebaker/cp_fix_test_closes_file_descriptors
cp: make test_closes_file_descriptors Linux-only
2023-11-09 09:45:16 +01:00
Zhuoxun Yang
fb414ed917 tests/printf: support %q 2023-11-09 10:18:27 +08:00
Daniel Hofstetter
761213f1d2 cp: make test_closes_file_descriptors Linux-only 2023-11-08 09:33:49 +01:00
Daniel Hofstetter
7afb8461cb du: add -H (alias for --dereference-args) 2023-11-07 10:30:54 +01:00
Sylvestre Ledru
1818632d7c
Merge pull request #5496 from cakebaker/cp_tail_fix_warnings_in_tests
cp,tail: fix warnings in tests on Android
2023-11-06 07:51:32 +01:00
Daniel Hofstetter
bbdde2890a du: ignore test under Android & FreeBSD 2023-11-05 14:27:20 +01:00
Daniel Hofstetter
91b19b7c56 cp,tail: fix warnings in tests on Android 2023-11-05 13:56:39 +01:00
Daniel Hofstetter
29f6631554 du: add -P/--no-dereference 2023-11-03 17:17:44 +01:00
zhitkoff
62887c7a58 split: directory separator in additional suffix 2023-11-02 17:17:38 +01:00
zhitkoff
f05474a33a split: slash separator 2023-11-02 17:17:38 +01:00
zhitkoff
fbb454a080 split: suffix auto-widening and auto-width tests 2023-11-02 17:17:38 +01:00
Terts Diepraam
98ad01b1cc
Merge pull request #5471 from cakebaker/cp_fix_unused_variable_warnings
cp: restrict two test functions to linux/mac/win
2023-11-01 09:11:38 +01:00
tommady
a4775d288b
cp: fix cp -rT dir dir2 leads to different result than with GNU cp (#5467)
* add a test case test_cp_treat_dest_as_a_normal_file

* fix 5457

* cp: fix comment

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-10-30 17:55:03 +01:00
Daniel Hofstetter
a7cc3b6dca cp: restrict two test functions to linux/mac/win 2023-10-29 14:37:47 +01:00
Sylvestre Ledru
c24a51403a
cat: return the same error message as GNU with loop symlink (#5466)
* cat: return the same error message as GNU with loop symlink

Should fix tests/du/long-sloop.sh because it is using cat as a ref
for error messages

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-10-28 22:29:24 +02:00
Mick van Gelderen
5c100dd088
mv: Fix stderr output mv file into dir and dir into file where both are files (#5464)
* Add tests mv file into dir and dir into file where both are files

* Fix test_mv_dir_into_file_where_both_are_files

* Fix test_mv_file_into_dir_where_both_are_files

* Store String in error instead of PathBuf

* Implement path_ends_with_terminator for windows

* Fix compilation on windows
2023-10-28 15:04:51 +02:00
Daniel Hofstetter
9f5db29145 cp: add test for --attributes-only 2023-10-27 09:34:31 +02:00
Daniel Hofstetter
6085cf12e3
Merge pull request #5353 from tommady/fix-5327
cp: fix cp -a --no-preserve=mode doesn't keep fully the mode
2023-10-25 13:34:45 +02:00
Terts Diepraam
96d0830952
Merge pull request #5446 from cakebaker/ls_try_get_matches_from
ls: use try_get_matches_from instead of get_matches_from
2023-10-25 11:25:40 +02:00
Daniel Hofstetter
9df50096c8
cp: remove "all" from cfg; rename test fn 2023-10-25 10:15:46 +02:00
Nathan Houghton
db26dabd6e tests/dd: Do not use the OS provided dd utility on FIFOs
On *BSD and macOS, the system provided dd utility opens up the output
file for both reading and writing. This means that the open/write to the
FIFO does not block, and almost instantly completes. The system dd then
exits, leaving nothing left to be read by the time the coreutils-rs dd
tries to open/read the FIFO.

Avoid this problem by just writing to the FIFO from the test case
itself, rather than relying on the system provide dd.
2023-10-25 00:05:56 -07:00
Daniel Hofstetter
6f84e56e28 ls: return exit code 2 for invalid time-style 2023-10-24 16:33:04 +02:00
Daniel Hofstetter
fd18d2686f ls: return exit code 2 for -l --dired --zero 2023-10-24 14:48:24 +02:00
David Matos
769eb29cd3
mv: moving directory itself should fail (#5429)
* mv: moving directory itself should fail

* mv: Check trailing slash also fails on target containing itself

* mv: add "spell-checker:ignore mydir" to test

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-10-24 10:54:23 +02:00
Nathan Houghton
dbfd700502 test: use mtime for -ot and fix direction of comparison
- Use the file modification time instead of the creation time (matches
  GNU coreutils documentation)

- Fix direction of comparison (a < b instead of a > b)

- Extend test case to cover both the 0 and 1 exit code cases
2023-10-22 17:44:40 -07:00
Daniel Hofstetter
94492c98a5 cp: --rem don't fail if dest is hardlink to source 2023-10-22 22:17:49 +02:00
Sylvestre Ledru
03d598d08b
Merge pull request #5430 from cakebaker/cp_remove_destination_shouldnt_fail
cp --remove-destination: don't fail if destination is symlink to source
2023-10-22 22:17:32 +02:00
Daniel Hofstetter
772892e2e4 cp: --rem don't fail if dest is symlink to source 2023-10-20 09:41:30 +02:00
Yury Zhytkou
eede467e21
split : --filter and stdin updates (#5418) 2023-10-20 08:47:32 +02:00
Sylvestre Ledru
f971a69d69
ls --dired -R: fix the positions (#5341)
* move get_offset_from_previous_line into a specific function

* dired: improve the -R support

* dired: fix the display with subdir

* ls --dired -R: fix the positions

* ls --dired -R: verify also the SUBDIRED coordinate

* ls --dired -R: add a long file name and fix a windows test

* dired: always put dired first in the args + minor fixes

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

* ls: add cognitive_complexity to silent a warning

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-10-19 14:17:34 +02:00
Daniel Hofstetter
a3c6d6d91e
Merge pull request #5423 from Luv-Ray/fix-pathchk-issue5314
`pathchk`: check empty path by default
2023-10-19 09:33:42 +02:00
Zhuoxun Yang
4424091592 tests/pathchk: check error message 2023-10-19 01:29:53 +08:00
Sylvestre Ledru
4573eb693f
Merge pull request #5357 from zhitkoff/issue5334-uucore-parse-r-q
Implement SI prefixes R and Q
2023-10-18 18:55:17 +02:00
Zhuoxun Yang
f63f9a06f6 tests/pathchk: test empty path 2023-10-18 22:50:54 +08:00
zhitkoff
7038657a44 implement R and Q prefixes 2023-10-17 10:50:50 -04:00
zhitkoff
cb7479e823 uucore: implement SI suffixes R and Q 2023-10-17 10:50:50 -04:00
Zhuoxun Yang
04ab5b0108 tests/expr: add tests for "" 2023-10-17 22:26:19 +08:00
Zhuoxun Yang
7421c81a22 tests/expr: sort test cases 2023-10-17 22:21:44 +08:00
Daniel Hofstetter
541ac6a813
Merge pull request #5403 from sylvestre/rm
rm: In some cases, remove_dir is doing a better job than remove_dir_all
2023-10-16 09:35:44 +02:00
Luv_Ray
46b8b41e3f
Merge branch 'main' into fix-expr-syntex-error 2023-10-14 23:50:21 +08:00
Zhuoxun Yang
5b1755387f tests/expr: test escape 2023-10-14 23:18:15 +08:00
Daniel Hofstetter
f6880bff8f expr: test some invalid syntaxes 2023-10-14 14:58:41 +02:00
Sylvestre Ledru
505ef714b9 rm: In some cases, remove_dir is doing a better job than remove_dir_all
use it when remove_dir_all failed

GNU compatibility (rm/empty-inacc.sh)
2023-10-14 12:09:27 +02:00
Zhuoxun Yang
40f05a331e tests/expr: add tests for test_and 2023-10-14 01:58:53 +08:00
Sylvestre Ledru
41188a915e
rename the test
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
2023-10-13 11:35:45 +02:00
Sylvestre Ledru
94972d45c7 ls: Document a bit tests/ls/stat-dtype.sh 2023-10-12 23:37:07 +02:00
zhitkoff
a920464952 split: undocumented options aliases + help fix 2023-10-11 12:13:22 -04:00
tommady
edb5b65b01
Merge branch 'main' of github.com:uutils/coreutils into fix-5327 2023-10-11 08:39:52 +00:00
Daniel Hofstetter
94f5fa9487
Merge pull request #5365 from Luv-Ray/fix-expr
`expr`: short-circuit evaluation for `|`
2023-10-08 14:55:59 +02:00
Zhuoxun Yang
e5d70d444a tests/expr: format 2023-10-07 10:41:10 +08:00
Sylvestre Ledru
a596cda516
Merge pull request #5355 from boxdot/main
relpath: remove
2023-10-06 20:39:25 +02:00
Luv_Ray
7bf4b7f674
tests/expr: add tests in test_expr.rs 2023-10-07 00:42:04 +08:00
Zhuoxun Yang
5a732dd21a tests/expr: add test expr 1 \| a / 5 2023-10-06 23:50:44 +08:00
Daniel Hofstetter
6dd53c7a71 clippy: fix warnings in tests 2023-10-06 10:11:26 +02:00
boxdot
e88183174b
relpath: remove
Closes #5236
2023-10-04 16:13:06 +02:00
tommady
5ce3720820
fix freebds mode_t is u16 but other unix platforms are u32 2023-10-04 09:12:26 +00:00
tommady
879b4f363d
Merge branch 'main' into fix-5327 2023-10-04 16:06:48 +08:00
tommady
88f88e51cc
fix expected , found and spelling errors 2023-10-04 07:12:25 +00:00
Terts Diepraam
9e9701974e
Merge pull request #5350 from cakebaker/echo_no_new_line
echo: don't output "\n" if "\c" is encountered
2023-10-03 17:35:58 +02:00
Daniel Hofstetter
54ba81ecbb mv: fix typo in test function name
test_mv_info_self -> test_mv_into_self
2023-10-03 15:09:20 +02:00
Daniel Hofstetter
c29bcb219f echo: don't output "\n" if "\c" is encountered 2023-10-03 14:37:15 +02:00
Daniel Hofstetter
139f205783
Merge pull request #5218 from tertsdiepraam/echo-fix-octal-wrapping
`echo`: fix wrapping behavior of octal sequences
2023-10-03 13:52:56 +02:00
Terts Diepraam
689b21d0b8
Merge pull request #5348 from cakebaker/cp_show_no_skipped_message
cp: show no "skipped" msg with -vi/-vin
2023-10-03 11:58:47 +02:00
Terts Diepraam
0f248d7525
Merge pull request #5347 from cakebaker/mv_show_no_skipped_message
mv: show no "skipped" msg with -vi/-vin
2023-10-03 11:58:31 +02:00
PGIII
252d01ac33
cp: fail when trying to copy to read only file on mac (#5261)
* cp: fail when trying to copy to read only file

* fix spelling error in macos.rs

* simplify permissions check

* add comment

* fix typo
2023-10-03 00:48:22 +02:00
Yury Zhytkou
c5a0aa92f8
split: implementing separator option (#5331)
* split: implementing separator option

* split: separator option - handle multiple update

* split: style

* split: separator tests

* split: separator tests - stdin in ci/cd

* split: tests - ci/cd stdin errors

* split: refactor based on feedback

* split: improve test coverage

* split: fix broken pipe error in tests with stdin

* split: fix for handle_multiple_separator_options

* split: comments

* split: refactor separator code

* split: changes based on feedback

* split: changes based on feedback
2023-10-03 00:42:46 +02:00
Daniel Hofstetter
8ee69d2b92 cp: show no "skipped" msg with -vi/-vin 2023-10-02 15:38:34 +02:00
Daniel Hofstetter
fda762b91c mv: show no "skipped" msg with -vi/-vin 2023-10-02 14:50:29 +02:00
Daniel Clarke
c27fcc4084
Update parse_datetime to 0.5.0 (#5313) 2023-10-01 18:01:46 +02:00
Sylvestre Ledru
7337cd5169 ls -R1: add a test to replicate GNU's recursive.sh 2023-10-01 17:03:57 +02:00
Daniel Hofstetter
95ccc54d05 nl: defer showing "line number overflow" error 2023-09-30 15:35:05 +02:00
tommady
718a527e9b
add testcase for no preserve mode 2023-09-30 07:09:57 +00:00
Daniel Hofstetter
bc7877b58c
Merge pull request #5124 from shinhs0506/seq-parse
seq: parse "infinity" and "-infinity"
2023-09-30 06:59:32 +02:00
Daniel Hofstetter
035032cd83
Merge pull request #5158 from cakebaker/nl_section_delimiter
nl: implement -d/--section-delimiter
2023-09-29 10:42:04 +02:00
Daniel Hofstetter
51eb20a15d fmt: use clap's value parser for goal & width 2023-09-28 10:50:56 +02:00
tommady
2789885648
cp: fix cp -dR --no-preserve=links d c should have different inodes (#5320)
* fix issue 5308
2023-09-27 13:16:10 +02:00
Daniel Hofstetter
ff500d7d6f expr: interpret numbers != 0 as true for | and & 2023-09-26 16:24:00 +02:00
Sylvestre Ledru
99120d32c1 cut: fail when the input == usize::MAX 2023-09-26 09:40:21 +02:00
Terts Diepraam
45487d47b8 extract Base enum 2023-09-25 12:02:45 +02:00
Leviticoh
b90b59c003
uniq: added support for deprecated -N option (#4228) 2023-09-24 14:44:44 +02:00
Sylvestre Ledru
e8b27d1714
Merge pull request #4527 from bbara/dd-skip-seek
dd: fix GNU test 'dd/skip-seek-past-dev'
2023-09-24 14:43:15 +02:00
Terts Diepraam
4ca792d2ff
Merge pull request #5306 from cakebaker/nl_fix_output_order_if_stdin_and_files_are_mixed
nl: fix output order if stdin and files are mixed
2023-09-24 12:12:54 +02:00
tommady
bd0fb817a7
cp: fix the result of inodes are not the same when preserve links is flagged (#5064)
Should fix:
```
rm -rf a b c
touch a
ln -s a b
mkdir c
./target/debug/coreutils cp --preserve=links -R -H a b c
a_inode=$(ls -i c/a|sed 's,c/.*,,')
b_inode=$(ls -i c/b|sed 's,c/.*,,')
echo "$a_inode" = "$b_inode"
```
2023-09-24 10:53:27 +02:00
Benjamin Bara
17f4d17021 tests: dd: add skip-seek-past-dev tests
These tests try to read or write past a block device, where the block device is either given as
stdin or stdout. It requires access to the block device, and therefore is executed as root. For now,
it is assumed that a block device "/dev/sda1" with a size smaller than 10000000000000000 exists.
2023-09-24 10:00:10 +02:00
Daniel Hofstetter
06219350fa nl: fix output order if stdin and files are mixed 2023-09-23 14:44:30 +02:00
Sylvestre Ledru
ba3f266b2c
Merge pull request #5285 from cakebaker/nl_multiple_files
nl: make line number and --join-blank-lines work over multiple files
2023-09-23 09:34:04 +02:00
Sylvestre Ledru
d6da6fb546
Merge pull request #5302 from cakebaker/relpath_fix_5300
relpath: show error if no argument provided
2023-09-22 23:30:52 +02:00
Daniel Hofstetter
38831c46d1 relpath: show error if no argument provided
Fixes #5300
2023-09-22 10:58:12 +02:00