Commit graph

5427 commits

Author SHA1 Message Date
dependabot[bot]
423ff9fe8b build(deps): bump gcd from 2.1.0 to 2.2.0
Bumps [gcd](https://github.com/frewsxcv/rust-gcd) from 2.1.0 to 2.2.0.
- [Release notes](https://github.com/frewsxcv/rust-gcd/releases)
- [Commits](https://github.com/frewsxcv/rust-gcd/compare/2.1.0...2.2.0)

---
updated-dependencies:
- dependency-name: gcd
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-27 21:10:27 +01:00
Sylvestre Ledru
13fac01d31
Merge branch 'main' into dependabot/cargo/blake3-1.3.2 2023-01-27 21:10:06 +01:00
Sebastian Bentmar Holgersson
999957791a expand: minor simplification of mode logic 2023-01-27 21:08:16 +01:00
Sebastian Bentmar Holgersson
1bf723fe40 expand: fix formatting issues and cleanup 2023-01-27 21:08:16 +01:00
Sebastian Bentmar Holgersson
69d8729598 expand: replace while loop with constant time algorithm 2023-01-27 21:08:16 +01:00
Sebastian Bentmar Holgersson
ddc6fabca0 expand: all perl tests passing 2023-01-27 21:08:16 +01:00
Sebastian Bentmar Holgersson
cbab8677e6 expand: improve handing of + 2023-01-27 21:08:16 +01:00
TechHara
3ad36a49cb
cut: refactor (#4255)
refactors `cut field` logic to reduce code duplication by factoring out the common `Searcer`, which is _templatized_ on a specific `Matcher` -- `ExactMatcher` for an explicit delimiter and `WhitespaceMatcher` for white-space delimiter.

before
- code duplication in `Searcher` and `WhitespaceSearcher`
- code duplication in `cut_fields` and `cut_fields_whitespace`

after
- two versions of `Matcher`s
- one `Searcher`
- simplify `cut_fields` by delegating actual work to specific functions
2023-01-27 21:07:36 +01:00
Daniel Hofstetter
f6b646e4e5 clippy: fix warnings introduced with Rust 1.67.0 2023-01-27 17:37:56 +01:00
Daniel Hofstetter
b06485990d comm: implement --total 2023-01-24 16:49:43 +01:00
Sylvestre Ledru
dce8a021da
Merge pull request #4299 from Joining7943/fix-4298-build-fails-on-s390x-and-risc64
`uucore`: Fix #4298: Fails to build on s390x (and riscv64)
2023-01-24 11:47:20 +01:00
Joining7943
9796e70a28 uucore: Fix #4298: Build on s390x and riscv64 architectures fails 2023-01-23 21:13:59 +01:00
Sylvestre Ledru
2df4aaccd9
Merge pull request #4263 from cakebaker/od_cleanup_format_strings
od: remove "width = width" from format strings
2023-01-22 21:32:59 +01:00
Sylvestre Ledru
6f95f0953b
Merge pull request #4271 from eds-collabora/eds/nice
Support legacy argument syntax for nice
2023-01-22 20:57:08 +01:00
Sylvestre Ledru
f30124e497 uname: use the same version of platform-info as arch 2023-01-21 23:24:53 +01:00
Terts Diepraam
4d3dc78686 Version 0.0.17 2023-01-21 10:38:18 +01:00
Emil Suleymanov
50c1833c11
cp: require preserve only certain attributes (#4099)
* cp: require preserve only certain attributes

# Conflicts:
#	src/uu/cp/src/copydir.rs
#	src/uu/cp/src/cp.rs

* tests/cp: preserve all and preserve xattr tests with todos

* tests/cp: rename preserve tests

* tests/cp: add android fail test for preserve=xattr

On Android, this cp with explicit preserve of xattr must fail, because of the limitations of the filesystem setup used on Android.

* cp: verify some metadata in cp preserve tests

# Conflicts:
#	tests/by-util/test_cp.rs

* cp: run test_cp_preserve_all in all OS's but only check metadata on linux

* test/cp: don't expect the mode to change in explicit cp preserve

* cp: attributes struct instead of enum for unified required tracking

* cp: refactor preserver and handle_preserve

# Conflicts:
#	src/uu/cp/src/cp.rs

* cp: update preserve attr to max

* test/cp: fix the preserve xattr test

Access timestamps appear to be modified only in this test. Running the command directly does not alter the access timestamp.

* cp/test: preserve all and context case

* cp: fix preserve args value source

* test/cp: don't check mtime on freebsd

* test/cp: don't check mtime on macos

* test/cp: fix freebsd deps

* test/cp: support freebsd tests

* cp: simplify try_set_from_string

* cp: parse context attr in preserve in any case to show warning later

* cp: print warnings for attribute errors if not required

* cp: show SELinux warning only once

* cp: show SELinux warning without error

* Revert "cp: show SELinux warning without error"

This reverts commit d130cf0d8c8e28ac2c903413992613241decf879.

* cp: add documentation for preserve components

* cp: simplify try_set_from_string

* cp: EN_US "behavior" spelling for cspell
2023-01-19 13:02:06 +01:00
Ed Smith
34e10f9aa8 nice: Remove use of show_warning
This is required to pass the GNU nice test suite. Failure to produce
the advisory message when unable to change the process priority must
be fatal, and without this commit our version of nice will exit, but
before the commit the exit code will be 101 (due to eprintln!
panicking), and it must be 125 to pass the test suite.

Signed-off-by: Ed Smith <ed.smith@collabora.com>
2023-01-18 11:44:41 +01:00
Ed Smith
07e7372311 nice: Permit --adjustment to be specified multiple times
This is tested by the GNU coreutils test suite, and the
correct behaviour is the last specification wins.

Signed-off-by: Ed Smith <ed.smith@collabora.com>
2023-01-18 11:44:41 +01:00
Ed Smith
8aa9f346ef Support legacy argument syntax for nice
This introduces an argument preprocessing step for the nice tool in
order to support the legacy nice adjustment syntax (`nice -1 foo`,
`nice --1 foo`, `nice -+1 foo` and so forth).

This is a preprocessing step because the interaction between these
arguments and the existing `nice -n -1` syntax becomes context
dependent, in a way that is currently difficult to capture through
clap.

Signed-off-by: Ed Smith <ed.smith@collabora.com>
2023-01-18 11:44:41 +01:00
Sylvestre Ledru
8c137f5d7c
Merge pull request #4278 from cakebaker/sum
sum: fix output when using BSD sum algo (-r)
2023-01-18 11:33:41 +01:00
Sylvestre Ledru
afbe850115
Merge pull request #4279 from rivy/up.uname
change/uname ~ update and revise
2023-01-18 11:33:29 +01:00
Sylvestre Ledru
f12202e39c
Merge pull request #4281 from cakebaker/default_trait_access
clippy: use type name instead of Default::default
2023-01-18 11:33:09 +01:00
Daniel Hofstetter
3489647407 cp: remove empty line from version output 2023-01-18 10:20:17 +01:00
Daniel Hofstetter
e09d718ca7 join: remove NAME constant 2023-01-17 16:10:32 +01:00
Daniel Hofstetter
f50c352adc clippy: use type name instead of Default::default 2023-01-16 10:52:28 +01:00
Roy Ivy III
03e55d2ecb docs ~ update spell-checker exceptions 2023-01-14 22:53:26 -06:00
Roy Ivy III
ead457171b refactor/uname ~ rename vars to standards 2023-01-14 22:53:26 -06:00
Roy Ivy III
759f32fe4f fix/uname ~ correct --all help description 2023-01-14 22:53:25 -06:00
Roy Ivy III
b5eaa8822f fix/uname ~ strip any trailing NUL(s) from nodename() (from bug in platform-info) 2023-01-14 22:53:25 -06:00
Roy Ivy III
27d20129fe fix/dd ~ correct usage error display text 2023-01-13 22:14:48 -06:00
Roy Ivy III
3d93e25160 fix/touch ~ correct usage error display text 2023-01-13 22:14:48 -06:00
Roy Ivy III
10f35fc282 refactor/uname ~ use platform_info-v1.0.2 2023-01-13 22:13:26 -06:00
Daniel Hofstetter
747bc2513e sum: fix output when using BSD sum algo (-r) 2023-01-13 10:05:09 +01:00
Sylvestre Ledru
6a9660f9f6
Merge pull request #4268 from rivy/fix.sleep
Fix `sleep` argument parsing and errors
2023-01-12 18:41:04 +01:00
Sylvestre Ledru
22821c8ac6
Merge pull request #4272 from cakebaker/mv_remove_unnecessary_not
mv: remove unnecessary "!"
2023-01-12 18:32:31 +01:00
Daniel Hofstetter
74ed737460 remove NAME constants 2023-01-12 15:21:11 +01:00
Sylvestre Ledru
74c9abb359
Merge pull request #4274 from cakebaker/sum_fix_output_of_about_string
sum, unexpand: fix output of about string
2023-01-11 16:33:39 +01:00
Daniel Hofstetter
5ad3cbe965 unexpand: fix output of about string 2023-01-11 15:55:37 +01:00
Daniel Hofstetter
0f79b3cf2d sum: fix output of about string 2023-01-11 14:44:59 +01:00
Sylvestre Ledru
46cac1145b
Merge pull request #4273 from cakebaker/pr_help_output
pr: add missing '\' before line breaks
2023-01-11 14:16:05 +01:00
Terts Diepraam
9ccfb025cf
Merge pull request #4264 from cakebaker/pr_seq_simplify_format_strings
pr,seq: simplify format strings
2023-01-11 13:17:13 +01:00
Daniel Hofstetter
073e6c8f62 pr: add missing '\' before line breaks 2023-01-10 10:55:36 +01:00
Daniel Hofstetter
aff18258e9 mv: remove unnecessary "!" 2023-01-09 09:38:37 +01:00
Roy Ivy III
5abeb012e8 fix/sleep: improve match of error output to GNU practices 2023-01-08 12:10:32 -06:00
Daniel Hofstetter
fe9779261f csplit: rename var to simplify format strings 2023-01-07 15:05:34 +01:00
Daniel Hofstetter
cc1f109906 pr,seq: simplify format strings 2023-01-06 10:39:43 +01:00
Daniel Hofstetter
83f76c514a od: remove "width = width" from format strings 2023-01-06 09:32:23 +01:00
Daniel Hofstetter
212ad777fc pr: remove commented out code line 2023-01-04 15:20:45 +01:00
Terts Diepraam
36f3507bed
Merge pull request #4232 from TechHara/whitespace
cut: add whitespace option for separating fields
2023-01-01 12:58:28 +01:00
Roy Ivy III
8753fb95c3 fix/expr: EXIT_CODE=1 for any return output parsable to 0 (or empty) 2022-12-29 22:49:02 -06:00
Roy Ivy III
fe954e5825 fix/expr: repair off-by-1 index operator error 2022-12-29 22:49:02 -06:00
dependabot[bot]
278e21b81b build(deps): bump blake3 from 1.3.1 to 1.3.2
Bumps [blake3](https://github.com/BLAKE3-team/BLAKE3) from 1.3.1 to 1.3.2.
- [Release notes](https://github.com/BLAKE3-team/BLAKE3/releases)
- [Commits](https://github.com/BLAKE3-team/BLAKE3/compare/1.3.1...1.3.2)

---
updated-dependencies:
- dependency-name: blake3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-26 10:25:33 +01:00
trasua
ef8f92f720 uucore: add options to parse_size::Parser to support parse_byte_count() in sort.rs 2022-12-26 10:23:20 +01:00
jaggededgedjustice
b8a755a396
date: Catch panic from invalid format string (#4240)
* Catch panic from invalid date string
2022-12-25 21:11:34 +01:00
TechHara
276b115c02 remove clippy allow; fmt 2022-12-23 09:56:21 -05:00
TechHara
20761fe422 simplify 2022-12-23 02:18:16 -05:00
TechHara
a53dcba6d3 mark fixme item -- use char for delimiter 2022-12-22 21:38:47 -05:00
TechHara
a549589682 fix clippy warnings 2022-12-21 08:01:31 -05:00
TechHara
f2a7175144 enum Delimiter; misc changes 2022-12-20 20:37:31 -05:00
Daniel Hofstetter
a0522f5cbd clippy: fix some "unnested or-patterns" warnings 2022-12-20 16:07:37 +01:00
TechHara
c29839f4f9 Merge branch 'main' into whitespace 2022-12-18 09:07:03 -05:00
TechHara
df8ce0c999 ignore multispace cspell 2022-12-18 09:06:47 -05:00
Joining7943
ca0414d867 clippy: Allow some unnecessary casts 2022-12-16 18:37:50 +01:00
Joining7943
c94a039358 clippy and doc: Fix warnings, mostly needless conversions. Fix documentation warning. 2022-12-16 18:36:27 +01:00
TechHara
bae78e62e0
Merge branch 'main' into whitespace 2022-12-15 22:23:03 -05:00
Sylvestre Ledru
c5728a61b4
fix some clippy warnings (#4229)
* fix some clippy warnings

* Fix the last two
2022-12-14 15:42:07 +01:00
Terts Diepraam
e4bed1c087
Merge pull request #4135 from Joining7943/refactor-tail-check-warnings
`tail`: Refactor handling of warnings and early exits
2022-12-14 13:21:54 +01:00
TechHara
4e2cfdb8ce add more comments 2022-12-14 04:07:12 -05:00
TechHara
76f818da05 fix whitespace 2022-12-13 21:02:16 -05:00
TechHara
27dfe63f4c add comments on the function logic 2022-12-13 20:57:46 -05:00
TechHara
db829321fc remove clippy complex 2022-12-13 11:51:05 -05:00
TechHara
5867a47f21 fix clippy complaint 2022-12-13 11:49:26 -05:00
TechHara
17c48e13f4 specify that cut -w is freebsd extension 2022-12-13 11:30:58 -05:00
TechHara
866a6d25c8 fix clippy complaint 2022-12-13 11:20:34 -05:00
Joining7943
b339f6d80c tests/tail: Add all additional tests written during refactoring tail from tip of refactoring branch
Other changes summmary:
* Use module level imports instead of fully qualified imports where appropriate
* Fix intermittent failing test_positive_zero_bytes because of broken pipe
* Cleanup old disabled test for warning of following indefinitely
2022-12-13 16:16:14 +01:00
Joining7943
93654d4504 tail: Add documentation for Settings::check_warnings and Settings::verify 2022-12-13 16:16:14 +01:00
Joining7943
2dc8a1b55e tail: Add gnu's warning when following stdin is ineffective. If no pid support set to 0 in Observer. 2022-12-13 16:16:14 +01:00
Joining7943
d57545d09c tail: Refactor: Handle warnings and early exits in one place. Remove InputService ...
Other changes summary:
* Cleanup imports
* Remove stdin_is_pipe_of_fifo function
* Rename WatcherService to Observer
2022-12-13 16:16:08 +01:00
Terts Diepraam
69caa45b01
Merge pull request #4219 from cakebaker/match_wildcard_for_single_variant
chore: fix wildcards that match single variant
2022-12-13 11:57:52 +01:00
Christian
00bbe24639
mv: add progress bar (#4220)
* mv: add progress bar

Similarly to `cp`, adds `-g` and `--progress` flags to enable a progress
bar via indicatif.
2022-12-13 11:46:54 +01:00
TechHara
188d84b154 minimize unnecessary code change 2022-12-13 01:14:14 -05:00
TechHara
f334ae3149 use match guard to minimize 2022-12-13 01:10:48 -05:00
TechHara
50c8bd4c6b fix 2022-12-13 00:48:17 -05:00
TechHara
21cf0b41ab add clippy 2022-12-13 00:11:01 -05:00
TechHara
1cc3f331e7 format 2022-12-12 22:29:31 -05:00
TechHara
6516519af3 Merge branch 'main' into whitespace 2022-12-12 22:07:05 -05:00
Sylvestre Ledru
f9c0ca4383
Merge pull request #4184 from jfinkels/cp-verbose
cp: correct --verbose --parents output for both files and directories
2022-12-12 21:31:15 +01:00
Sylvestre Ledru
c78e077ff2
Merge pull request #4194 from jfinkels/dd-single-byte-written
dd: correct progress line if 1 byte written
2022-12-12 21:30:10 +01:00
TechHara
f6a0abaee3 add whitespace delimiter option 2022-12-12 12:00:57 -05:00
Daniel Hofstetter
81243db948 chore: fix wildcards that match single variant 2022-12-06 10:50:34 +01:00
ctsk
8a837dae21 Tick after creating progress bar to draw it 2022-12-06 10:36:52 +01:00
Kai M
42b9b7b62c
install: fix issue #3814 (#3950)
* install: fix installing one file when using -Dt options

* install: fix installing multiple files with -Dt

Code was missing the logic to create the target dir when multiple files
should be copied and target dir is given by -t option.
This simplifies the copy logic also when only one file should be copied
to the target dir.

* install: fix verbose output when using -D

Also adds a unit test to verify the same behaviour as the gnu tools.

* install: add more testcases for create leading dir

Tests various combinations of "-D" with and w/o "-t" when installing
either a single file or multiple files into a non existing directory.

  install -D file1 file2 (-t) not_existing_dir
  install -D file1 (-t) not_existing_dir/

Also fixes file formatting, spelling and adds some more test asserts.

* install: fix error for nonex. dir path ending on /

The install command failed with a different error message than the
original GNU install tool. Checking for a trailing slash fixes this.
Only works on unix though.

* install: add windows support when checking for '/'

* install.rs: fix spelling

* install.rs: add more tests regarding omitting dir

This increases the CI test coverage and also checks for more corner
cases to ensure uu_install is compliant with GNU's original.

    export C=coreutils/target/debug/

    rm -rf dir1 no-dir2 dir3 file
    mkdir -p dir1 dir3
    touch file

    ${C}install dir1/file1 dir1/.. no-dir2
    ${C}install dir1/file1 dir1/.. dir3
    ${C}install dir1/.. dir3

* install: improve test_install_missing_arguments

Also check that install returns the correct error messages, when only a
target directory is given via -t and that is is not created (-D option).

* install: rework the checks for missing file args

This ensures correct (GNU install like) behavior. Tests from the last
commit will pass now.
2022-12-06 09:11:23 +01:00
Sylvestre Ledru
24340665ee
Merge pull request #4216 from jfinkels/cp-preserve-hardlinks-readability
cp: improve readability of preserve_hardlinks()
2022-12-06 08:44:44 +01:00
Jeffrey Finkelstein
54a36df9ab dd: correct progress line if 1 byte written
Correct the progress report written by `dd` if exactly one byte is
written so that it says "1 byte" instead of "1 bytes".
2022-12-05 21:41:26 -05:00
Jeffrey Finkelstein
1a839fb2c4 cp: correct --verbose --parents output for dirs
This commit corrects the behavior of `cp -r --parents --verbose` when
the source path is a directory, so that it prints the copied ancestor
directories. For example,

    $ mkdir -p a/b/c d
    $ cp -r --verbose --parents a/b/c d
    a -> d/a
    a/b -> d/a/b
    'a/b/c' -> 'd/a/b/c'
2022-12-05 21:37:13 -05:00
Jeffrey Finkelstein
bd665ea44a cp: correct --verbose --parents output for files
This commit corrects the behavior of `cp --parents --verbose` when the
source path is a file so that it prints the copied ancestor
directories. For example,

    $ mkdir -p a/b d
    $ touch a/b/c
    $ cp --verbose --parents a/b/c d
    a -> d/a
    a/b -> d/a/b
    'a/b/c' -> 'd/a/b/c'

Fixes #3332.
2022-12-05 21:36:56 -05:00
Jeffrey Finkelstein
92e1bb98fe cp: improve readability of preserve_hardlinks()
Improve readability of the `preserve_hardlinks()` helper function by
reducing levels of nesting in the body of the function and making it
return a Boolean rather than mutating a Boolean argument.
2022-12-05 21:28:22 -05:00
Sylvestre Ledru
b7925465a8 factor: trim the input to fix some busybox results 2022-12-05 22:49:48 +01:00
Jeffrey Finkelstein
682667fd1d cp: force link between two files that exist
Allow `cp` to link files that exist. For example,

    $ touch src dest
    $ cp -f --link src dest

Before this commit, an error was raised.
2022-12-04 19:36:05 -05:00