Commit graph

4670 commits

Author SHA1 Message Date
Terts Diepraam
ebe6341ae3 chore: replace tempdir with tempfile 2021-05-27 22:47:03 +02:00
Sylvestre Ledru
41539df91d
Merge pull request #2280 from jhscheer/symlink_tests
Improve symlink/hardlink handling in tests
2021-05-27 09:41:48 +02:00
Terts Diepraam
aec8f2c151
Merge pull request #2284 from blesson3/mv-backup-refactor
mv: refactor backup logic to use shared uucore backup control
2021-05-27 08:49:36 +02:00
Matt Blessed
f11f5f3abb mv: refactor backup logic to use shared uucore backup control
- add mv backup tests
2021-05-26 18:23:48 -04:00
Terts Diepraam
b4f6c81810
Merge pull request #2281 from deantvv/chmod-match-gnu-error
chmod: match GNU error
2021-05-26 21:13:05 +02:00
Terts Diepraam
658e52dde0
Merge pull request #2275 from blesson3/cp-backup-support
cp: implement backup support
2021-05-26 21:12:01 +02:00
Matt Blessed
25ed5eeb0e cp: move option check to uumain and use show_usage_error
- add test for conflicting options `--backup` and `--no-clobber`
2021-05-26 11:10:04 -04:00
Dean Li
fe25b51a66
chmod: match GNU error
Related to #2260

Signed-off-by: Dean Li <deantvv@gmail.com>
2021-05-26 22:31:02 +08:00
Terts Diepraam
00dd8d29cb
Merge pull request #2213 from syukronrm/du-clap
du: replace getopts with clap
2021-05-26 16:15:36 +02:00
Sylvestre Ledru
c08eae8e9a
Merge pull request #2276 from ycd/clear-macros
uucore: delete unused macros
2021-05-26 13:45:30 +02:00
Jan Scheer
efd5921bda tests/test: replace call to 'ln -s' with call to 'AtPath::symlink_file' 2021-05-26 13:42:12 +02:00
Sylvestre Ledru
2f58f92b06
Merge pull request #2277 from ycd/refactor-error-macro
uucore: refactor show_error! macro
2021-05-26 13:13:24 +02:00
Jan Scheer
6a70d89e8c tests/du: replace call to 'ln' with call to 'AtPath::hard_link' 2021-05-26 12:55:53 +02:00
Jan Scheer
afb1b9efb4 tests/util: add AtPath::hard_link 2021-05-26 12:53:11 +02:00
Syukron Rifail M
eda72b5208 du: replace getopts with clap 2021-05-26 11:23:05 +07:00
Matt Blessed
a8a1ec7faf cp: implement backup control with tests 2021-05-25 23:22:32 -04:00
Yağız can Değirmenci
12f207a6d6 test: fix tests 2021-05-26 03:21:53 +03:00
Yağız can Değirmenci
8fe34c72d2 test: fix tests 2021-05-26 03:07:49 +03:00
Yağız can Değirmenci
071899d24d tests: delete 'error:' prefix from the tests 2021-05-26 02:45:53 +03:00
Matt Blessed
7240b12895 uucore: implement backup control
Most of these changes were sourced from mv's existing backup control
implementation. A later commit will update the mv utility to use this
new share backup control.
2021-05-25 19:44:09 -04:00
Yağız can Değirmenci
898d2eb489 chore: delete 'error:' prefix on show_error 2021-05-26 02:32:02 +03:00
Yağız can Değirmenci
c78a7937f8 chore: delete show_info macro and replace with show_error 2021-05-26 02:27:10 +03:00
Yağız can Değirmenci
a77e92cc96 chore: delete unused macros 2021-05-26 01:53:40 +03:00
Sylvestre Ledru
cdd74afa3f
Merge pull request #2273 from ycd/mv-perm-error
mv: log proper error message when permission error occurs
2021-05-25 21:44:04 +02:00
Sylvestre Ledru
f0a962868a
Merge pull request #2274 from sylvestre/gnu-ci2
Try to decrease the size of the GNU log
2021-05-25 18:12:23 +02:00
Sylvestre Ledru
97d15e34d9
Disable some factor tests 2021-05-25 14:58:56 +02:00
Sylvestre Ledru
98f09a6b8b gnu/ci: don't run seq-precision - logs are too long 2021-05-24 22:33:53 +02:00
Sylvestre Ledru
962e4198b2 gnu/ci: limit the number of factor runs 2021-05-24 22:33:53 +02:00
Yağız can Değirmenci
e5e7ca8dc5 fix: simplify logic 2021-05-24 21:20:59 +03:00
Yağız can Değirmenci
991fcc548c fix: log error messages properly on permission errors 2021-05-24 21:07:45 +03:00
Terts Diepraam
da085eca98
Merge pull request #2259 from jfinkels/wc-compute-each-file-and-print
wc: print counts for each file as soon as computed
2021-05-24 17:55:10 +02:00
Sylvestre Ledru
9f73a9faf4
Merge pull request #2272 from miDeb/expr-substr
expr: make substr infallible
2021-05-24 00:11:59 +02:00
Michael Debertol
218f523e1b expr: make substr infallible
Instead of returning an Err it should return the "null string"
(in our case that's the empty string) when the offset or length
is invalid.
2021-05-23 22:22:34 +02:00
Sylvestre Ledru
4061ada132
Merge pull request #2267 from jhscheer/who_fix_runlevel
who: exclude `--runlevel` from non Linux targets (fix #2239)
2021-05-23 13:41:56 +02:00
Sylvestre Ledru
3dfc3c64de
Merge pull request #2268 from sylvestre/windows-ci
Workaround the Windows CI install issue.
2021-05-23 13:40:59 +02:00
Sylvestre Ledru
1860e61f83 Workaround the Windows CI install issue.
Fails trom time to time with:
```
info: installing component 'rustc'
memory allocation of 16777216 bytes failed
Error: The process 'C:\Rust\.cargo\bin\rustup.exe' failed with exit code 3221226505
```

on  Build (windows-latest, i686-pc-windows-gnu, feat_os_windows)
2021-05-23 10:35:46 +02:00
Sylvestre Ledru
7bf076505f
Merge branch 'master' into who_fix_runlevel 2021-05-23 09:32:37 +02:00
Sylvestre Ledru
b175534a97
Merge pull request #2264 from miDeb/sort-sort-flag
sort: support --sort flag and check for conflicts
2021-05-23 09:30:03 +02:00
Sylvestre Ledru
41bd025d00
Merge pull request #2209 from jfinkels/head-ring-buffer
head: add abstractions for "all but last n lines"
2021-05-23 09:28:17 +02:00
Sylvestre Ledru
de81014646
Merge pull request #2266 from sylvestre/rustfmt
rustfmt the recent change
2021-05-23 09:26:25 +02:00
Jeffrey Finkelstein
bc9db289e8 head: add abstractions for "all but last n lines"
Add some abstractions to simplify the `rbuf_but_last_n_lines()`
function, which implements the "take all but the last `n` lines"
functionality of the `head` program. This commit adds

- `RingBuffer`, a fixed-size ring buffer,
- `ZLines`, an iterator over zero-terminated "lines",
- `TakeAllBut`, an iterator over all but the last `n` elements of an
  iterator.

These three together make the implementation of
`rbuf_but_last_n_lines()` concise.
2021-05-22 23:56:48 -04:00
Jan Scheer
44c033a013 who: exclude --runlevel from non Linux targets (fix #2239) 2021-05-23 03:05:15 +02:00
Sylvestre Ledru
95092e6440 ignore test_should_calculate_implicit_padding_per_free_argument
Fails from time to time with
```
---- test_numfmt::test_should_calculate_implicit_padding_per_free_argument stdout ----
current_directory_resolved:
run: /target/x86_64-unknown-linux-musl/debug/coreutils numfmt --from=auto    1Ki         2K
thread 'test_numfmt::test_should_calculate_implicit_padding_per_free_argument' panicked at 'failed to write to stdin of child: Broken pipe (os error 32)', tests/common/util.rs:859:21
```
2021-05-23 00:34:01 +02:00
Sylvestre Ledru
4aaeede3d8 rustfmt the recent change 2021-05-23 00:13:53 +02:00
Sylvestre Ledru
70e65c419f
Merge pull request #2263 from sylvestre/json-hash
gnu/ci: also store the hash in the json
2021-05-22 23:36:02 +02:00
Michael Debertol
c1f67ed775 sort: support --sort flag and check for conflicts
`sort` supports three ways to specify the sort mode: a long option
(e.g. --numeric-sort), a short option (e.g. -n) and the sort flag
(e.g. --sort=numeric).
This adds support for the sort flag.

Additionally, sort modes now conflict, which means that an error is
shown when multiple modes are passed, instead of silently picking a mode.
For consistency, I added the `random` sort mode to the `SortMode` enum,
instead of it being a bool flag.
2021-05-22 23:10:41 +02:00
Sylvestre Ledru
9f0ef3ba54 gnu/ci: also store the hash in the json 2021-05-22 21:59:54 +02:00
Sylvestre Ledru
726f271273
Merge pull request #2239 from devnexen/fbsd_who_build_fix
who freebsd build fix unsupported RUN_LVL option only for other platf…
2021-05-22 21:34:09 +02:00
Jeffrey Finkelstein
4521aa2659 wc: print counts for each file as soon as computed
Change the behavior of `wc` to print the counts for a file as soon as
it is computed, instead of waiting to compute the counts for all files
before writing any output to `stdout`. The new behavior matches the
behavior of GNU `wc`.

The old behavior looked like this (the word "hello" is entered on
`stdin`):

    $ wc emptyfile.txt -
    hello
	  0       0       0 emptyfile.txt
	  1       1       6
	  1       1       6 total

The new behavior looks like this:

    $ wc emptyfile.txt -
	  0       0       0 emptyfile.txt
    hello
	  1       1       6
	  1       1       6 total
2021-05-22 14:27:37 -04:00
Sylvestre Ledru
73fb426b2b
Merge pull request #2252 from jfinkels/realpath-simplify
realpath: use uucore::fs::canonicalize() to reduce code duplication
2021-05-22 19:10:59 +02:00