Commit graph

2403 commits

Author SHA1 Message Date
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
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