Commit graph

962 commits

Author SHA1 Message Date
Thomas Queiroz
6127ea9642 tests/tail: add test for as an alias for stdin 2021-08-01 17:20:30 -04:00
James Robson
0e04f959c2 Add Physical mode to realpath
This adds the 'Physical Mode' and 'Logical Mode' switches to realpath, which control when symlinks are resolved.
2021-08-01 17:06:09 +01:00
Michael Debertol
450a487d76 sort: ignore broken pipes in a test
Since sort exits early due to the nonexistent file, it might no longer
be around when we try to send it the input.
This is "by design" and can be ignored.
2021-08-01 18:02:52 +02:00
Michael Debertol
af47c66a00 sort: improve tests 2021-08-01 17:12:35 +02:00
Jeffrey Finkelstein
8f5b785180 fixup! basename: handle paths comprising only slashes 2021-08-01 10:05:01 -04:00
Sylvestre Ledru
2d84c68f20
Merge branch 'master' into sort/input-is-output 2021-08-01 13:51:19 +02:00
Jeffrey Finkelstein
0d348f05f2 basename: handle paths comprising only slashes
Fix an issue where `basename` would print the empty path when provided
an input comprising only slashes (for example, "/" or "//" or
"///"). Now it correctly prints the path "/".
2021-07-31 18:57:02 -04:00
Michael Debertol
663c9751a1 sort: do not exit with failure for "--version" or "--help" 2021-08-01 00:05:08 +02:00
Michael Debertol
418f5b7692 sort: handle empty merge inputs 2021-07-31 21:02:20 +02:00
Michael Debertol
5bf4536bdd sort: ignore failure to truncate the output file 2021-07-31 21:02:20 +02:00
Michael Debertol
849086e9c5 sort: handle cases where the output file is also an input file
In such cases we have to create a temporary copy of the input file to prevent
overwriting the input with the output. This only affects merge sort, because it
is the only mode where we start writing to the output before having read all inputs.
2021-07-31 21:02:18 +02:00
Sylvestre Ledru
103a9d52ff
Merge pull request #2521 from miDeb/sort/rand
sort: improve compatibility of --random-sort
2021-07-31 21:00:18 +02:00
Michael Debertol
3564dc5792 sort: compare strings before comparing hashes
Since lines that compare equal should be sorted together, we need to first
compare the lines (taking settings into account). Only if they do not compare
equal we should compare the hashes.
2021-07-31 20:07:05 +02:00
Michael Debertol
f851fb6454 sort: initialize the salt when the random setting is on a key as well
Additionall, change the type of `salt` from `String` to `Option<[u8; 16]>`.
2021-07-31 20:07:05 +02:00
Michael Debertol
095e53aed2 sort: disallow equal lines for --check with --unique 2021-07-31 19:57:41 +02:00
Sylvestre Ledru
6b73ddcd12 Silent the spell checker on a test examples 2021-07-31 10:38:32 +02:00
Sylvestre Ledru
1eb3b62c46
Merge pull request #2537 from jfinkels/expand-improve-tabs-argument-2
expand: expand support for --tabs arguments
2021-07-31 10:33:08 +02:00
Sylvestre Ledru
638b31a877
Merge pull request #2520 from miDeb/sort/fixes
sort: fix some exit codes and error messages
2021-07-31 10:11:12 +02:00
Sylvestre Ledru
8620220298
Merge pull request #2511 from dezgeg/stat-t
stat: Support \t in --printf format
2021-07-31 09:52:42 +02:00
Sylvestre Ledru
fd02ef2dc1
Merge pull request #2516 from jfinkels/tac-read-dir-error-message
tac: correct error message when reading from directory
2021-07-31 09:49:54 +02:00
Sylvestre Ledru
00f6fce89d
Merge pull request #2518 from jfinkels/tac-no-line-separators-in-file
tac: handle no line separators in file
2021-07-31 09:44:29 +02:00
Sylvestre Ledru
938f79aebc
Merge branch 'master' into sort/fixes 2021-07-31 09:42:35 +02:00
Jeffrey Finkelstein
fb477360b2 expand: expand support for --tabs arguments
Add support for

* space-separated list of tab stops, like `--tabs="2 4 6"`,
* mixed comma- and space-separated lists, like `--tabs="2,4 6"`,
* the slash specifier in the last tab stop, like `--tabs=1,/5`,
* the plus specifier in the last tab stop, like `--tabs=1,+5`.
2021-07-30 23:46:02 -04:00
Michael Debertol
1bb530eebb sort: validate input files at startup 2021-07-30 23:41:18 +02:00
Michael Debertol
a33b6d87b5 sort: open the output file at the beginning
This causes us to print an error message about an invalid output file
right at the start of the invocation, but *after*  verifying other arguments.
2021-07-30 23:40:53 +02:00
Michael Debertol
c6e044927c sort: print check messages to stderr, not stdout 2021-07-30 23:37:35 +02:00
Michael Debertol
891d25cebd sort: fix exit codes and error messages 2021-07-30 23:37:35 +02:00
Michael Debertol
a214ca60bd sort: allow null bytes for -t 2021-07-30 23:30:52 +02:00
Jeffrey Finkelstein
2648f330e4 tac: handle no line separators in file
Change the behavior of `tac` when there are no line separators in the
input. Previously, it was appending an extra line separator; this commit
prevents that from happening. The input is now writted directly to
stdout.
2021-07-25 15:19:29 -04:00
Jeffrey Finkelstein
abf4c69b28 tac: correct error message when reading from dir.
Correct the error message produced by `tac` when trying to read from a
directory. Previously if the path 'a' referred to a directory, then
running `tac a` would produce the error message

    dir: read error: Invalid argument

after this commit it produces

    a: read error: Invalid argument

which matches GNU `tac`.
2021-07-25 13:55:24 -04:00
Daniel Rocco
d8d71cc477 test: handle additional parentheses edge cases
Handle additional edge cases arising from test(1)’s lack of reserved words.
For example, left parenthesis followed by an operator could indicate
either

* string comparison of a literal left parenthesis, e.g. `( = foo`
* parenthesized expression using an operator as a literal, e.g. `( = != foo )`
2021-07-24 23:02:02 -04:00
Tyler
d1907edd65 Adds additional words to exclude list. Improves documentation in dd.rs. 2021-07-24 16:38:08 -07:00
Tyler
076ff32e85 Removes project-specific cspell files. 2021-07-23 14:53:24 -07:00
Tuomas Tynkkynen
46a2491727 stat: Support \t in --printf format 2021-07-23 19:04:18 +03:00
Tyler
885a875552 Addresses build errors
- Adds words to cspell exceptions
- Converts test macros to use Default trait.
- Converts parser to use Default trait.
- Adds Windows-friendly test files for block/unblock when nl is present
  in test/spec file.
2021-07-22 16:04:35 -07:00
Tyler
989849eca7 Ignores linux-only tests on non-linux platforms. 2021-07-21 18:24:31 -07:00
Tyler
95d9f03cff Merge branch 'master' of github.com:backwaterred/coreutils 2021-07-21 17:33:18 -07:00
backwaterred
7c94bbe238
Merge branch 'uutils:master' into master 2021-07-21 17:33:07 -07:00
Tyler
9d9267e08b Addresses code-quality issues from testsdiepraam and miDeb.
- Removes dd from feat_require_unix (keeps it in feat_common_core)
- Changes name of make_linux_iflags parameter from oflags to iflags.
- Removes roughed out SIGINFO impl.
- Renames plen -> target_len.
- Removes internal fn def for build_blocks and replaces with a call to
  chunks from std.
- Renames apply_ct to the more descriptive apply_conversion
- Replaces manual swap steps in perform_swab with call to swap from std.
- Replaces manual solution with chunks where appropriate (in Read, and Write impl).
- Renames xfer -> transfer (in local variable names).
- Improves documentation for dd_filout/dd_stdout issue.
- Removes commented debug_assert statements.
- Modifies ProdUpdate to contain ReadStat and WriteStat rather than
  copying their fields.
- Addresses verbose return in `Output<File>::new(...)`
- Resoves compiler warning when built as release when signal handler fails to
  register.
- Derives _Default_ trait on ReadStat.
- Adds comments for truncated lines in block unblock tests
- Removes `as u8` in block unblock tests.
- Removes unecessary `#[inline]`
- Delegates multiplier string parsing to uucore::parse_size.
- Renames 'unfailed' -> 'succeeded' for clairity.
- Removes #dead_code warnings. No clippy warnings on my local machine.
- Reworks signal handler to better accomodate platform-specific signals.
- Removes explicit references to "if" and "of" in dd.rs.
- Removes explicit references to "bs", "ibs", "cbs" and "status" in
  parseargs.rs.
- Removes `#[allow(deadcode)]` for OFlags, and IFlags.
- Removes spellchecker ignore from all dd files.
- Adds tests for 'traditional' and 'modern' CLI.
2021-07-21 17:25:10 -07:00
Syukron Rifail M
37c986b005 test_du: ignore unsupported --time=birth 2021-07-19 06:55:11 +07:00
Jan Scheer
36a192c5f6
id: fix error handling for id_print() 2021-07-13 11:25:03 +02:00
Jan Scheer
7abc6a665e
id: add conditional compilation for selinux 2021-07-13 00:22:10 +02:00
Tyler
94e0145d51 fixes more minor issues 2021-07-12 12:54:39 -07:00
Terts Diepraam
337d257e8d tests/sleep: fmt 2021-07-12 20:21:20 +02:00
Son Nguyen
6c26976edb
sleep: use UResult (#2492)
* sleep: use UResult in util

* sleep: add in error + test for it

* sleep: UResult - removed some verbosity
2021-07-12 20:20:23 +02:00
Tyler
994b4d9a3e Merge remote-tracking branch 'upstream/master' 2021-07-12 10:22:20 -07:00
Tyler
88363858d5 Minor changes. 2021-07-12 10:13:47 -07:00
Jan Scheer
92bc647ac3
Merge branch 'master' into id_selinux_context 2021-07-12 17:30:21 +02:00
Sylvestre Ledru
caf984bd55 fix various clippy issues 2021-07-11 11:22:33 +02:00
Sylvestre Ledru
52c6593ef5
Merge pull request #2486 from hbina/hbina-tr-return-err-when-extra-args
`tr` should error out when if user provides more than 2 sets
2021-07-10 20:51:27 +02:00
Jan Scheer
30b80d0c82
tr: fix squeeze and complement with two sets (#2485) 2021-07-09 23:05:00 +02:00
Hanif Bin Ariffin
c4c6819dae Reimplemented simply using args
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-07-09 23:51:37 +08:00
Sylvestre Ledru
2177b8dc37
Merge pull request #2481 from Funky185540/fix/test_du_bytes_nondynamic_on_linux
test: du: Skip nondynamic comparison on linux for test_du_bytes
2021-07-09 09:11:52 +02:00
Jan Scheer
cf2c712e6b
Merge branch 'master' into id_selinux_context 2021-07-09 00:21:05 +02:00
Tyler
9aac61c672 Merge branch 'master' of github.com:backwaterred/coreutils 2021-07-08 11:12:25 -07:00
Tyler
47806ddd39 build issues
- Address Rust fmt issue
- ignores run-without-noatime test which fails on some build machines
- adds cspell:disable to all project files.
- adds .../dd/fixtures/cspell.json to ignore test fixtures.
2021-07-08 11:10:48 -07:00
backwaterred
fdfe2dcc1f
Merge branch 'uutils:master' into master 2021-07-08 10:47:51 -07:00
Jan Scheer
14b348dd4b
tests: fix tests for CICD environment 2021-07-08 11:17:18 +02:00
Tyler
4f7dda4be9 Completes final? issues barring PR
- Adds cspell.json. Hopefully this will make you happy, spellchecker.
- Removes non-functional spellchecker-ignore tags
- Adds a sleep call to the no noatime test. Some systems were did not notice a changed
  atime without the option present.
- Adds a test with a unicode filename.
- Addresses clippy lints and rustfmt issues.
2021-07-07 17:34:31 -07:00
Jan Scheer
d59cd4fc4a
Merge branch 'master' into refactor_expected_result 2021-07-08 00:44:32 +02:00
Jan Scheer
d57f474ae1
test_whoami: refactor use expected_result and whoami from common/util.rs 2021-07-08 00:21:28 +02:00
Jan Scheer
abc59fbe85
tests/common: refactor: use TestScenario instead of util_name for expected_result() 2021-07-07 22:46:16 +02:00
Jan Scheer
31aa8b2062
test_du: refactor use expected_result from common/util.rs 2021-07-07 22:09:01 +02:00
Jan Scheer
735ec4014e
test_who: refactor use expected_result from common/util.rs 2021-07-07 17:26:59 +02:00
Jan Scheer
805e024794
test_stat: refactor use expected_result from common/util.rs 2021-07-07 15:54:03 +02:00
Jan Scheer
90de4257b1
test_pinky: refactor use expected_result from common/util.rs 2021-07-07 15:53:46 +02:00
Jan Scheer
c2bd7ae9b1
test_id: refactor use expected_result from common/util.rs 2021-07-07 15:53:26 +02:00
Jan Scheer
9631d8cf2b
test_groups: refactor use expected_result from common/util.rs 2021-07-07 15:52:56 +02:00
Sylvestre Ledru
df683f8c84
Merge pull request #2465 from miDeb/install-test
[: install test as [ as well
2021-07-07 15:43:38 +02:00
Sylvestre Ledru
7018ff8925
Merge pull request #2477 from dhodder/uname_target_env
uname: don't report OS as "GNU/Linux" without GNU
2021-07-07 08:46:50 +02:00
Tyler
2e9e984b3a Adds test with unicode filename
Filenames should be the only spot where unicode can appear in dd's cli.
2021-07-06 18:17:30 -07:00
Tyler
74e0071cfe fixes conv=nocreat test failure 2021-07-06 17:47:26 -07:00
backwaterred
96f93488ef
Merge branch 'uutils:master' into master 2021-07-06 15:59:03 -07:00
Dave Hodder
330f797378 tests/uname: add --operating-system test 2021-07-06 23:40:38 +01:00
Tyler
d2cebad931 addresses a few more issues from PR#2474
- adds project header to multiple files
- updates spell check skip words
- removes linux only flags direct,noatime from mac_os build
- applies rustfmt to test_dd
2021-07-06 15:35:48 -07:00
Tyler
1ad89c5e89 Addresses issues raised in PR#2474
- runs rustfmt on test_dd.rs
- eliminates compiler warnings
- adds many words to spellchecker ignore list
- adds sanity test for vexing conv=nocreat issue. Still WIP.
2021-07-06 11:52:48 -07:00
Andreas Hartmann
f64b708410 test: du: Skip nondynamic comparison on linux for test_du_bytes
The `test_du_bytes` testcase for the `du --bytes` command is written to perform
a dynamic comparison on linux hosts, i.e. it compares the output of the command
to that of the hosts `du` from the GNU coreutils.

Previously the test was written such that it would *first* perform the dynamic
comparison, and *after that* continue to a static comparison which may fail for
specific hosts that have a filesystem different from what the test expects.

This patch excludes linux hosts from the static comparison to ensure the test
performs only the dynamic comparison.
2021-07-06 19:45:06 +02:00
Michael Debertol
8ace291b32 sort: make -k only take one argument per flag
This makes it so that `sort -k 1 file` treats `file` as the input file
and not the second key.
2021-07-06 15:47:32 +02:00
Jan Scheer
e53f4db33a Merge branch 'master' into id_selinux_context 2021-07-06 13:29:50 +02:00
Michael Debertol
bc0727cc4d [: add support for --help and --version
I copied the help text verbatim from GNU, I hope that's ok.
2021-07-06 13:15:07 +02:00
Sylvestre Ledru
1136221f6f rustfmt the recent change 2021-07-04 13:01:31 +02:00
Sylvestre Ledru
ae1935c3cb
Merge branch 'master' into master 2021-07-04 11:57:59 +02:00
Sylvestre Ledru
91078cfcb3
Merge pull request #2445 from syukronrm/du-inodes
du: add `--inodes`
2021-07-04 11:28:03 +02:00
Sylvestre Ledru
d3652cc3c0
Merge pull request #2457 from Funky185540/install-implement-backup
install: implement --backup, -b and -S
2021-07-04 09:57:45 +02:00
Tyler
5b030b4855 Minor cleanup
- Removes compiler warnings.
- Renames conv=nocreat test to be more descriptive.
2021-07-02 11:50:33 -07:00
backwaterred
9c38583c6b
Merge pull request #2 from uutils/master
catchup with uutils main
2021-07-02 11:34:22 -07:00
Tyler
92281585a7 Merge branch 'master' of https://github.com/uutils/coreutils into uutils-master 2021-07-01 14:33:30 -07:00
Terts Diepraam
7a0a7aecc4
Merge pull request #2461 from miDeb/sort/check-no-out
sort: disable -o with -C and -c
2021-07-01 13:07:05 +02:00
Terts Diepraam
6213a2a967
Merge pull request #2462 from miDeb/sort/version
sort/ls: implement version cmp matching GNU spec
2021-07-01 13:02:59 +02:00
Tyler
17cfba41cc Implements project testfing from root.
- conv=FLAG testing. (1) WIP conv=nocreat
- iflag & oflag testing.
- conv=CONV ascii,...,ucase,...,block,...sync tests at unit-test-level
  (project root is todo)
2021-06-30 14:47:48 -07:00
Terts Diepraam
73a7ead857 mktemp: adapt to standardized error handling 2021-06-28 13:55:55 +02:00
Syukron Rifail M
27e0507844 du: more tests 2021-06-28 07:51:17 +07:00
Syukron Rifail M
d8a33da5b3 du: add --inodes 2021-06-28 07:51:17 +07:00
Michael Debertol
d3732e08c4 sort: disable -o with -C and -c 2021-06-27 16:21:18 +02:00
Michael Debertol
233a778963 sort/ls: implement version cmp matching GNU spec
This reimplements version_cmp, which is used in sort and ls to sort
according to versions.
However, it is not bug-for-bug identical with GNU's implementation.
I reported a bug with GNU here:
https://lists.gnu.org/archive/html/bug-coreutils/2021-06/msg00045.html
This implementation does not contain the bugs regarding the handling of
file extensions and null bytes.
2021-06-27 15:29:17 +02:00
Andreas Hartmann
69e8838b27 tests: install: Add tests for '--backup'
Tests the '--backup' option for the install utility. Most of the code is
adapted from the respective tests for 'mv'.
2021-06-27 09:55:10 +02:00
Michael Debertol
548a895cd6 sort: compatibility of human-numeric sort
Closes #1985.
This makes human-numeric sort follow the same algorithm as GNU's/FreeBSD's sort.
As documented by GNU in https://www.gnu.org/software/coreutils/manual/html_node/sort-invocation.html,
we first compare by sign, then by si unit and finally by the numeric value.
2021-06-25 18:19:00 +02:00
Sylvestre Ledru
ab5d581fa4
Merge pull request #2439 from tertsdiepraam/numfmt/round-and-c-locale
`numfmt`: add `--round` and other minor improvements
2021-06-24 21:18:59 +02:00
Sylvestre Ledru
5d7cf61128
Merge pull request #2429 from miDeb/install/target-dir
install: support --target-directory
2021-06-24 21:06:44 +02:00
Sylvestre Ledru
3b2d0d17fa
Merge pull request #2446 from jhscheer/groups_gnu_testsuite
groups: fixes to pass GNU's Testsuite
2021-06-23 20:15:12 +02:00
Sylvestre Ledru
44c770d234
Merge pull request #2450 from jhscheer/id_refactor_identifier
id: refactor identifiers
2021-06-23 19:05:57 +02:00
Jan Scheer
11f36eae3b tests/groups: fix/add tests for (multiple) username(s) 2021-06-23 16:50:03 +02:00
Sylvestre Ledru
d40fc65ee6
Merge branch 'master' into numfmt/round-and-c-locale 2021-06-23 12:39:55 +02:00
Sylvestre Ledru
a73e71ba74
Merge pull request #2437 from miDeb/cp/reflink-auto
cp: default to --reflink=auto on linux and macos
2021-06-23 12:37:44 +02:00
Sylvestre Ledru
87eaf6e80a
Merge pull request #2447 from jhscheer/locale_c
fix some issues with locale (replace "LANGUAGE" with "LC_ALL")
2021-06-23 12:36:40 +02:00
Jan Scheer
4b3da59b0e id: refactor identifiers
* change of identifier names and spelling according to the suggestions in the review of #2446
2021-06-23 12:27:01 +02:00
Jan Scheer
c0be979611 fix some issues with locale (replace "LANGUAGE" with "LC_ALL")
`LANGUAGE=C` is not enough, `LC_ALL=C` is needed as the environment
variable that overrides all the other localization settings.

e.g.
```bash
$ LANGUAGE=C id foobar
id: ‘foobar’: no such user

$ LC_ALL=C id foobar
id: 'foobar': no such user
```

* replace `LANGUAGE` with `LC_ALL` as environment variable in the tests
* fix the the date string of affected uutils
* replace `‘` and `’` with `'`
2021-06-23 11:30:28 +02:00
Sylvestre Ledru
178399c20e
Merge pull request #2449 from miDeb/temp-win
Make tests pass on a windows VM
2021-06-23 08:40:30 +02:00
Michael Debertol
ce0801db90 tests/mv: test uutils mv instead of system util
Calling `cmd_keepenv("mv")` spawned the system `mv` instead of
the uutils `mv`. Also, `keepenv` isn't necessary because it doesn't
need to inherit environment variables.
We now actually check the stderr, because previously the result of
`ends_with` was not used, making the test pass even when it shouldn't.

I disabled the test on windows because `mkdir` does not support `-m` on
windows, making the test fail because there will be no permission error.
On FreeBSD there isn't a permission error either, and `mv` succeeds.
2021-06-23 00:58:19 +02:00
Michael Debertol
622504467f mktemp: note that windows uses a different env var for tmpdir
On windows `std::env::temp_dir` uses the `TMP` environment variable
instead of `TMPDIR`.
2021-06-22 17:44:45 +02:00
Michael Debertol
e5a7bcbb9d tests: keep env vars for the temporary directory
On some Windows machines this would otherwise cause `std::env::temp_dir`
to fall back to a path that is not writeable (C:\\Windows).
Since by default integration tests don't inherit env vars from the
parent, we have to override this in some cases.
2021-06-22 17:43:46 +02:00
Sylvestre Ledru
e48ff9dd9e
Merge pull request #2441 from siebenHeaven/ls_dangling_symlinks
ls: Fix problems dealing with dangling symlinks
2021-06-21 22:34:15 +02:00
Sylvestre Ledru
2f11a23016
Merge pull request #2431 from miDeb/pr/races
tests/pr: include one more possible minute
2021-06-21 22:30:37 +02:00
Tyler
47464f50a1 Begin project level testing. Minor fixes. 2021-06-21 11:17:47 -07:00
Jan Scheer
f1d317147b id: add support for showing SELinux context (--context/-Z) 2021-06-20 13:44:41 +02:00
Anup Mahindre
ffb6b7152f tests: Fix ls dangling symbolic links test output for windows
On windows we do not print inode numbers at all, so skip checking for ?
for dangling symbolic links in expected output
2021-06-20 16:58:28 +05:30
Anup Mahindre
d0039df8c3 tests: Add test for dangling symlinks with ls
Add test similar to gnu dangling symlinks test
2021-06-20 13:50:38 +05:30
Roy Ivy III
f5edc500e0 tests ~ fix spelling errors 2021-06-19 18:40:22 -05:00
Terts Diepraam
3086e95702 numfmt: add round and use C locale style for errors 2021-06-20 00:21:14 +02:00
Sylvestre Ledru
115eb5eb52
Merge pull request #2432 from dezgeg/test-bracket-syntax
test: Implement [ expr ] syntax
2021-06-19 19:14:20 +02:00
Michael Debertol
9fb927aa85 cp: always delete the destination for symlinks 2021-06-19 18:59:57 +02:00
Tuomas Tynkkynen
7b9814c778 test: Implement [ expr ] syntax
When invoked via '[' name, last argument must be ']' or we bail out with
syntax error. Then the trailing ']' is simply disregarded and processing
happens like usual.
2021-06-19 18:49:21 +03:00
Sylvestre Ledru
5ba69d4a35
Merge pull request #2412 from syukronrm/du-dereference
du: add `--dereference`
2021-06-19 12:05:18 +02:00
Sylvestre Ledru
ac98960f32
Merge pull request #2427 from miDeb/ln/recursive-relative
ln: don't return an empty path in `relative_path`
2021-06-19 12:03:59 +02:00
Sylvestre Ledru
e2a00b67ed
Merge pull request #2428 from jhscheer/cut_2424
cut: fix `-d=` (#2424)
2021-06-19 08:46:42 +02:00
Michael Debertol
285eeac1fb tests/pr: include one more possible minute 2021-06-18 18:49:39 +02:00
Terts Diepraam
f1e043ca1b
Merge pull request #2361 from jhscheer/id_zero_2351
id: revamp to pass more of GNU's Testsuite
2021-06-18 18:10:49 +02:00
Terts Diepraam
e273cb8e4f
Merge pull request #2426 from miDeb/cp/symlinks
cp: improve symlink handling
2021-06-18 17:27:50 +02:00
Michael Debertol
4e62c9db71 install: support target-directory 2021-06-18 16:45:36 +02:00
Jan Scheer
65f47be5ee cut: fix -d= (#2424) 2021-06-18 12:10:40 +02:00
Michael Debertol
3d3af5c8ca ln: don't return an empty path in relative_path 2021-06-18 11:53:29 +02:00
Tuomas Tynkkynen
d05964a8cb test: Implement -k
parser.rs already accepts this, finish the implementation.
2021-06-18 00:03:08 +03:00
Michael Debertol
12a1c87cb8 cp: improve symlink handling 2021-06-17 22:26:13 +02:00
Terts Diepraam
439b7e0ca5
Merge pull request #2415 from miDeb/touch/date-epoch
touch: support @<timestamp> date format
2021-06-17 10:36:03 +02:00
Syukron Rifail M
bc8415c9db du: add --dereference 2021-06-17 14:06:41 +07:00
Michael Debertol
816c55dce4 sort: avoid sigpipe errors
By calling `unwrap` we get a panic instead of an abort, and since we
mute sigpipe panics for all utilites, no error message will be printed.
2021-06-17 00:06:39 +02:00
Terts Diepraam
ce6d439a1b
Merge pull request #2381 from miDeb/sort/merge-improvements
sort: delete temporary files as soon as possible
2021-06-17 00:00:59 +02:00
Jan Scheer
39aa5312ed id/tests: skip tests for multiple_user feature if there's not at least coreutils id version 8.31 in $PATH 2021-06-16 23:52:55 +02:00
Jan Scheer
88367c6fb4 Merge branch 'fix_getgrouplist' into id_zero_2351 2021-06-16 19:20:34 +02:00
Jan Scheer
54cbb69d37 id/tests: fix tests if run on macOS 2021-06-16 19:16:29 +02:00
Michael Debertol
4c5ee1dbd7 tty: correct exit code for write errrors 2021-06-16 17:55:48 +02:00
Michael Debertol
aeaf2cebfb tests/tty: fix test inputs
calling `pipe_in("</dev/null")` does not pipe in the `/dev/null` file,
but the raw string "</dev/null".

Closes https://github.com/uutils/coreutils/issues/2301
2021-06-16 17:43:49 +02:00
Hanif Bin Ariffin
23de181171 Added tests for cp --preserve without args
Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
2021-06-16 11:32:15 +08:00
Michael Debertol
84affa2137 touch: support @<timestamp> date format
parse `@<seconds since epoch>` as a valid date.
2021-06-15 22:43:40 +02:00
Michael Debertol
d4914b6943 sort: add a test for --batch-size 2021-06-15 19:09:22 +02:00
Daniel Rocco
22fbf16b2c test: implement user, group ownership checks
closes #2337
2021-06-14 14:30:17 -04:00
Terts Diepraam
553f70b06a
Merge pull request #2408 from Foryah/issue-2346
touch: change the error message to match the GNU error message #2346
2021-06-14 13:43:44 +02:00
David Suilea
25240ba61c
touch: change the error message to match the GNU error message #2346 2021-06-14 13:03:14 +02:00
Terts Diepraam
dfe0314d8d
Merge pull request #2397 from miDeb/sort/args
sort: refactor command line arguments
2021-06-14 12:49:19 +02:00
Terts Diepraam
05c8883b1a
Merge pull request #2395 from miDeb/timeout/cmd-args
timeout: handle arguments for the command to run
2021-06-14 12:01:31 +02:00
Terts Diepraam
b6f27a9a63
Merge pull request #2358 from siebenHeaven/du_threshold
Implement du threshold argument handling
2021-06-14 10:58:30 +02:00
Jan Scheer
052202ca19 Merge branch 'master' into id_zero_2351 2021-06-13 11:30:43 +02:00
Jan Scheer
17c6f4c13a id: add more tests to be consistent with GNU testsuite tests (tests/id/zero.sh) 2021-06-13 11:11:04 +02:00
Michael Debertol
d8c8e6774f tests/pr: formatting 2021-06-12 18:03:00 +02:00
Michael Debertol
bb029193e2 tests/pr: prevent races
Allow any timestamp from the start of the command to its end to show up
in stdout.
2021-06-12 18:03:00 +02:00
Michael Debertol
8e7eedebe7 tests: take slices in stdout_is_fixture 2021-06-12 18:03:00 +02:00
Anup Mahindre
fa12b46c51 tests: Add test for du threshold feature 2021-06-12 19:56:05 +05:30
Michael Debertol
af6e92e012 Merge branch 'master' of https://github.com/uutils/coreutils into sort/args 2021-06-12 13:16:46 +02:00
Michael Debertol
a69c2d52f9 Merge branch 'master' of https://github.com/uutils/coreutils into timeout/cmd-args 2021-06-12 13:14:16 +02:00
Terts Diepraam
440eba628c
Merge pull request #2338 from miDeb/ln/dst-symlink
ln: canonicalize the parent directory of the destination, not the destination itself
2021-06-12 11:28:19 +02:00
Terts Diepraam
8afc923796
Merge pull request #2237 from wfscheper/wfscheper/issue2118
chgrp: replace getopts with clap (#2118)
2021-06-12 11:20:24 +02:00
Jan Scheer
39f5f70f2b Merge branch 'master' into refactoring_parse_size 2021-06-12 02:24:07 +02:00
Michael Debertol
b8d4411291 sort: fix ignore-leading-blanks long option 2021-06-11 20:46:23 +02:00
Michael Debertol
fb035aa049 sort: allow --check=<value> syntax
* --check=silent and --check=quiet, which are equivalent to -C.
* --check=diagnose-first, which is the same as --check

We also allow -c=<value>, which confuses GNU sort.
2021-06-11 20:46:23 +02:00
Terts Diepraam
ddb196dd1d chgrp: fix clippy and spell-check warnings 2021-06-11 17:24:12 +02:00
Jan Scheer
d99385e585 id: add more tests for multiple and/or invalid usernames 2021-06-11 12:00:26 +02:00
Syukron Rifail M
0c364e635b du: add --one-file-system 2021-06-11 16:18:57 +07:00
Walter Scheper
cff75f242a chgrp: replace getopts with clap (#2118) 2021-06-10 16:38:44 -04:00
Michael Debertol
0f9bc8e974 timeout: disable timeout if it is set to zero 2021-06-10 21:24:43 +02:00
Michael Debertol
8e0ed2d20e timeout: support --verbose 2021-06-10 21:24:43 +02:00
Michael Debertol
c5d7cbda32 timeout: handle arguments for the command to run
To prevent clap from parsing flags for the command to run as flags for
timeout, remove the "args" positional argument, but allow to pass flags
via the "command" positional arg.
2021-06-10 17:03:32 +02:00
Michael Debertol
5997853cc4 Merge branch 'master' of https://github.com/uutils/coreutils into ln/dst-symlink 2021-06-10 16:06:32 +02:00
Jan Scheer
44d1790d1f id: add more tests for '--zero' 2021-06-10 10:33:22 +02:00
Jan Scheer
00c05b8687 id: add error handling (stderr/exit_code) for '-ugG' 2021-06-10 00:19:23 +02:00
Jan Scheer
026570ff9c id: add more tests for '--zero'
* fix clippy warnings
2021-06-09 22:45:39 +02:00
Sylvestre Ledru
def5bec1ce
Merge pull request #2373 from tertsdiepraam/groups/use-id-in-tests
`groups`: fix test for Arch-based systems
2021-06-09 22:44:51 +02:00
Jan Scheer
be8650278b Merge branch 'master' into refactoring_parse_size 2021-06-09 13:44:40 +02:00
Terts Diepraam
145e705b74 groups: fix clippy lint in test 2021-06-09 12:39:25 +02:00
Jan Scheer
babf6ecae4 Merge branch 'master' into id_zero_2351 2021-06-08 23:22:29 +02:00
Terts Diepraam
06b6066e89 groups: enable tests for non-linux unix systems 2021-06-08 22:53:48 +02:00
Sylvestre Ledru
4471335609
Merge pull request #2360 from rivy/fix+rf
build and *lots* of clippy fixes
2021-06-08 22:06:11 +02:00
Terts Diepraam
d846c40372 groups: fix test for arch 2021-06-08 21:45:02 +02:00
Jan Scheer
26ad05cbb4 uucore: fix order of group IDs returned from entries::get_groups()
As discussed here: https://github.com/uutils/coreutils/pull/2361
the group IDs returned for GNU's 'group' and GNU's 'id --groups'
starts with the effective group ID.
This implements a wrapper for `entris::get_groups()` which mimics
GNU's behaviour.

* add tests for `id`
* add tests for `groups`
* fix `id --groups --real` to no longer ignore `--real`
2021-06-08 18:39:05 +02:00
Jan Scheer
98225105af id: implement '--zero' flag
* add tests for '--zero' flag
* add a bunch of requires/conflicts rules for flags (incl. tests)
2021-06-07 14:35:13 +02:00
Roy Ivy III
1faa9eebab refactor/polish ~ cargo make format 2021-06-06 19:28:25 -05:00
Roy Ivy III
9feff1e441 tests ~ fix cargo clippy complaint (*allow* clippy::needless_borrow; for *false positives*) 2021-06-06 19:28:25 -05:00
Roy Ivy III
26cb6540da tests ~ fix cargo clippy complaint (clippy::useless_format) 2021-06-06 19:28:25 -05:00
Roy Ivy III
0dc8c18bac tests ~ fix cargo clippy complaint (clippy::needless_borrow) 2021-06-06 19:28:25 -05:00
Roy Ivy III
5553416b87 tests ~ fix clippy complaint (clippy::bool_assert_comparision) 2021-06-06 19:17:18 -05:00
Jan Scheer
0033928128 sort: fix broken tests for '--batch-size' (replace 'B' with 'b')
https://github.com/uutils/coreutils/pull/2297#issuecomment-855460881
2021-06-06 22:56:11 +02:00
Jan Scheer
12de58aec0 Merge branch 'master' of github.com:uutils/coreutils into refactoring_parse_size 2021-06-06 22:54:02 +02:00
Michael Debertol
7c9da82b39 sort: implement --batch-size 2021-06-06 18:01:08 +02:00
Michael Debertol
8d213219c7 sort: implement --compress-program 2021-06-06 18:01:08 +02:00
Michael Debertol
5a5c7c5a34 sort: properly check for empty reads 2021-06-06 18:01:08 +02:00
Michael Debertol
66359a0f56 sort: insert line separators after non-empty files
If files don't end witht a line separator we have to insert one,
otherwise the last line will be combined with the first line of the next
file.
2021-06-06 18:01:08 +02:00
Michael Debertol
e7fa6715a7 Merge branch 'master' of https://github.com/uutils/coreutils into ln/dst-symlink 2021-06-04 19:42:19 +02:00
Jan Scheer
81e07a6a4d od: replace 'piped_stdin' to make test stable 2021-06-04 17:22:45 +02:00
Jan Scheer
f8e96150f8 fix clippy warnings and spelling
* add some missing LICENSE headers
2021-06-04 15:39:34 +02:00
Mikadore
4a84c15955 fix minrustv build error 2021-06-04 00:19:44 +02:00
Mikadore
afd7acb456 fmt 2021-06-03 23:39:47 +02:00
Mikadore
07f744c4ba added invalid utf8 tests 2021-06-03 23:38:31 +02:00
Jan Scheer
130bf49e5d Merge branch 'master' of github.com:uutils/coreutils into refactoring_parse_size 2021-06-03 22:32:34 +02:00
Jan Scheer
db3ee61742 du/sort/od/stdbuf: make error handling of SIZE/BYTES/MODE arguments more consistent
* od: add stderr info for not yet implemented '--strings' flag
2021-06-03 21:00:03 +02:00
Jan Scheer
ad26b7a042 head/tail/split: make error handling of NUM/SIZE arguments more
consistent

* add tests for each flag that takes NUM/SIZE arguments
* fix bug in tail where 'quiet' and 'verbose' flags did not override each other POSIX style
2021-06-03 20:37:29 +02:00
Michael Debertol
6c46d09397 ln: canonicalize the parent directory of dst, not dst
dst may or may not exist. In case it exists it might already be a symlink.
In neither case we should try to canonicalize dst, only its parent directory.

https://www.gnu.org/software/coreutils/manual/html_node/ln-invocation.html
> Relative symbolic links are generated based on their canonicalized
> **containing directory**, and canonicalized targets.
2021-06-03 19:10:22 +02:00
Sylvestre Ledru
841b689477
Merge pull request #2334 from sylvestre/crate_version
use crate_version!() instead of reading the env + rustfmt
2021-06-03 10:56:57 +02:00
Sylvestre Ledru
24032498ad
Merge pull request #2339 from sylvestre/gnu-compat
Improve the gnu compat and use it for "touch"
2021-06-03 10:53:47 +02:00
Sylvestre Ledru
963a0da0b4
Merge pull request #2288 from syukronrm/du-time
du: fix `--time` behavior
2021-06-03 07:56:41 +02:00
Sylvestre Ledru
5de623cfab
Merge pull request #2330 from miDeb/cp/close-fd
cp: close file descriptors after cow on linux
2021-06-03 07:54:34 +02:00
Syukron Rifail M
05aeaf3061 du: fix --time behavior 2021-06-03 08:18:23 +07:00
Sylvestre Ledru
31875a241f touch/gnu compat: 'touch no-file' exit code should be 1 2021-06-02 23:50:35 +02:00
Sylvestre Ledru
eb2c06c37e touch/gnu compat: when touch fails because of a permission error, change the error message
+ return 1 as error code when having this error
2021-06-02 23:48:16 +02:00
Jan Scheer
5898b99627 truncate: add error handling for SIZE argument
* add tests for SIZE argument
* fix clap argument handling for --size and --reference
2021-06-02 22:08:42 +02:00
Jan Scheer
2f5f7c6fa1 split: use "parse_size" from uucore
* make stderr of parsing SIZE/NUMBER argument consistent with GNU's behavior
* add error handling
* add tests
2021-06-02 21:32:41 +02:00
Michael Debertol
ed69d797b5 ln: reject --relative without --symbolic 2021-06-02 21:02:12 +02:00
Michael Debertol
7ffc7d073c cp: test that file descriptors are closed 2021-06-02 19:21:16 +02:00
Sylvestre Ledru
6aa53ead7c rustfmt the recent change 2021-06-02 18:43:35 +02:00
Terts Diepraam
48516cc06a pr: fix usage of current time 2021-06-02 17:18:07 +02:00
Sylvestre Ledru
132ddf98b6
Merge pull request #2328 from miDeb/seq/validator
seq: reject NaN arguments
2021-06-02 11:20:13 +02:00
Jan Scheer
6b8de1dd8b sort: use "parse_size" from uucore
* make parsing of SIZE argument consistent with GNU's behavior
* add error handling
* add tests
2021-06-02 05:13:57 +02:00
Michael Debertol
a323e9cda1 cp: show errors in cow on linux 2021-06-01 23:06:38 +02:00
Michael Debertol
5329d77cc2 seq: adapt output to GNU seq 2021-06-01 20:35:18 +02:00
Michael Debertol
9b29ac98a5 seq: reject NaN arguments
Move the validation logic to an argument validator.
2021-06-01 18:30:18 +02:00
Michael Debertol
06b3092f5f sort: fix debug output for zeros / invalid numbers
We were reporting "no match" when sorting something like "0 ". This is
because we don't distinguish between 0 and invalid lines when sorting.
For debug output we have to get this information back.
2021-06-01 18:18:51 +02:00
Jan Scheer
cc659c8572 Merge branch 'master' of github.com:uutils/coreutils into refactoring_parse_size 2021-06-01 12:35:48 +02:00
Jan Scheer
3c7175f00d head/tail: add fixes and tests for bytes/lines NUM arg (undocumented sign)
* change tail bytes/lines clap parsing to fix posix override behavior
* change tail bytes/lines NUM parsing logic to be consistent with head
2021-06-01 12:17:11 +02:00
Jan Scheer
84f2bff778 head: use "parse_size" from uucore 2021-06-01 09:30:43 +02:00
Sylvestre Ledru
a017c1b589
Merge pull request #2323 from miDeb/maint/spellcheck-all
maint: actually run spellcheck on all files
2021-05-31 23:36:56 +02:00
Sylvestre Ledru
8618771f2e
Merge pull request #2322 from miDeb/seq/improvements
seq: improve compatibility
2021-05-31 23:09:13 +02:00
Michael Debertol
41878f1bf4 refactor/pr: polish spelling 2021-05-31 22:46:01 +02:00
Sylvestre Ledru
7b7185f916 Fix clippy warnings in the pr tests 2021-05-31 21:20:55 +02:00
Michael Debertol
4cf18e96f3 seq: change default value for -t and remove dubious escape sequences
GNU seq does not support -t, but always outputs a newline at the end.
Therefore, our default for -t should be \n.

Also removes support for escape sequences (interpreting a literal "\n"
as a newline). This is not what GNU seq is doing, and unexpected.
2021-05-31 21:20:19 +02:00
Michael Debertol
6ccc305513 seq: implement integer sequences
If we notice that we can represent all arguments as BigInts, take a
different code path. Just like GNU seq this means we can print an
infinite amount of numbers in this case.
2021-05-31 21:20:12 +02:00
Sylvestre Ledru
badf7aacb7
Merge pull request #2300 from tertsdiepraam/pr
Implement `pr` (resurrection of the resurrected PR)
2021-05-31 21:14:57 +02:00
Sylvestre Ledru
15da98d84e
Merge pull request #2315 from rivy/maint.fmt+spell
Spell check and correct the project
2021-05-31 21:00:04 +02:00
Jan Scheer
8bf1e33b5d Merge branch 'master' of github.com:uutils/coreutils into refactoring_parse_size
* truncate: use "parse_size" from uucore
* workaround fix for "test_reference"
2021-05-31 19:11:06 +02:00
Sylvestre Ledru
8d714b0ab0
Merge pull request #2317 from deantvv/fix-touch-parse-date
Fix touch parse date error
2021-05-31 18:18:44 +02:00
Dean Li
9d8e7b9acb
Fix touch parse date error
Now it can parse `touch -d 2000-01-23 file` and add test for parse date
error.

Related to #2311
2021-05-31 22:04:03 +08:00
Roy Ivy III
3f35e0a421 refactor ~ cargo make format 2021-05-31 08:23:58 -05:00
Roy Ivy III
4e20dedf58 tests ~ refactor/polish spelling (comments, names, and exceptions) 2021-05-31 08:23:57 -05:00
Terts Diepraam
7690dc018f Merge branch 'master' into pr 2021-05-31 15:23:06 +02:00
Sylvestre Ledru
13fd02862c
Merge pull request #2316 from deantvv/rmdir-match-gnu-error
rmdir: match GNU error output
2021-05-31 15:23:03 +02:00
Jan Scheer
f9a088cecf du: use "parse_size" from uucore
* fix stderr to be the same than GNU's `du` in case of invalid SIZE
2021-05-31 15:22:37 +02:00
Dean Li
9f1deb2df6
rmdir: match GNU error output
Related to #2258
2021-05-31 19:30:54 +08:00
Sylvestre Ledru
8c5dcd0765
Merge branch 'master' into implement-more 2021-05-31 10:17:15 +02:00
Jan Scheer
1c41efd732 stdbuf: use "parse_size" from uucore 2021-05-31 09:35:46 +02:00
Terts Diepraam
99fb2c5aac
Merge pull request #2310 from sylvestre/clippy2
Fix a clippy warning
2021-05-30 23:06:10 +02:00
Sylvestre Ledru
69850942b6 fix a clippy warning
WARNING: `cargo clippy`: single-character string constant used as pattern
2021-05-30 16:26:03 +02:00
Anup Mahindre
898d325aea ls: Fix minor output mismatch
When a single directory is passed to ls in recursive mode, uutils ls
won't print the directory name
======================
GNU ls:
z:
======================
======================
uutils ls:
======================

This commit fixes this minor inconsistency and adds corresponding test.
2021-05-30 18:00:52 +05:30
Sylvestre Ledru
3913731222
Revert "rmdir: match GNU error output" 2021-05-30 09:55:02 +02:00