Commit graph

1260 commits

Author SHA1 Message Date
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
Jan Scheer
c447863c8d
tests/common: refactor to reduce duplicate code
* move fn expected_result to common/util.rs
* move fn check_coreutil_version to common/util.rs
* move fn whoami to common/util.rs
* move macro unwrap_or_return to common/macros.rs
* add documentation
* add tests
2021-07-07 14:59:14 +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
98088db9ff tests: add _any functions
This should make it easier to write tests that could have different
valid outputs depending on timing.
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
Terts Diepraam
a8c5ffc024
Merge pull request #2391 from jhscheer/cmdresult_new
tests/util: add CmdResult::new()
2021-06-11 17:04:24 +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
Jan Scheer
ae03b09c6d tests/util: add CmdResult::new() 2021-06-11 09:08:14 +02: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
7df5acc2dc tests ~ fix cargo clippy complaint (*allow* clippy::manual_strip; with FixME/ToDO)
- replace with the included/noted code when MSRV includes a stabilized `String::strip_prefix()`
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
Michael Debertol
e5c4681e04 tests: add the ability to set resource limits 2021-06-02 19:21:12 +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
fc2b61eb96 tests: typo 2021-06-01 23:06:51 +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
Dean Li
5b417e251d
rmdir: match GNU error output
Related to #2258
2021-05-30 10:45:54 +08:00
Michael Debertol
dc63133f14
sort: correctly inherit global flags for keys (#2302)
Closes #2254. We should only inherit global settings for keys when there
are absolutely no options attached to the key.

The default key (matching the whole line) is implicitly added only if no
keys are supplied.

Improved some error messages by including more context.
2021-05-29 23:25:56 +02:00
Michael Debertol
d821719c67
expr: support arbitrary precision integers (#2271)
* expr: support arbitrary precision integers

Instead of i64s we now use BigInts for integer operations. This means
that no result or input can be out of range.
The representation of integer flags was changed from i64 to u8 to make
their intention clearer.

* expr: allow big numbers as arguments as well

Also adds some tests

* expr: use num-traits to check bigints for 0 and 1

* expr: remove obsolete refs

match ergonomics made these avoidable.

* formatting

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2021-05-29 23:25:23 +02:00