Sylvestre Ledru
818012e30b
Merge pull request #4193 from jfinkels/touch-relative-time
...
touch: add support for some relative times
2022-12-03 10:16:21 +01:00
Jeffrey Finkelstein
66ee373373
cp: preserve hard links when target already exists
...
Prevent a panic in `cp -a` when the target of a hard link already
exists in the target directory structure.
For example,
$ mkdir -p src dest/src
$ touch src/f dest/src/f
$ ln src/f src/link
$ cp -a src dest
The `cp` command now succeeds without error.
2022-12-02 23:50:18 -05:00
Daniel Hofstetter
9a2174ba02
chore: standardize creation of empty strings
2022-12-01 13:49:23 +01:00
Jeffrey Finkelstein
9632db4f86
dd: correctly set file size when conv=sparse
...
Before this commit, if `sparsefile` were a regular file of non-zero
size whose contents are all null bytes, then
dd if=sparsefile of=outfile conv=notrunc
would have resulted in `outfile` having zero size as reported by
`stat`. After this commit, `outfile` will have the same size as
`sparsefile` (even if the contents are represented sparsely by the
filesystem).
2022-11-29 22:53:18 +01:00
Jeffrey Finkelstein
a396ebd883
touch: add support for some relative times
...
For example,
$ touch -d +1 days
Fixes #3964 .
2022-11-29 22:53:13 +01:00
Sylvestre Ledru
27958a27ef
Merge pull request #4159 from sylvestre/issue_3780
...
date: add a test for the issue 3780 to make sure we don't regress
2022-11-27 18:24:07 +01:00
Miles Liu
3896aa31be
cp: fix cp --force --backup f f
fails on macOS
2022-11-20 18:14:42 +08:00
Jeffrey Finkelstein
903ad1656d
dd: move tests of slow reader to test_dd.rs
...
Move some tests that simulate a slow reader from `dd.rs` to
`tests/by-util/test_dd.rs`, and employ a FIFO and `sleep()` to
simulate the slow reader instead of a custom struct that implements
`Read`. This change restricts the type of `Input`s the
`Output::dd_out()` function can accept, facilitating a future change
to make `Input` an enum.
2022-11-19 09:27:23 -05:00
Terts Diepraam
1b35e467ac
Merge pull request #4137 from jfinkels/dd-bytes-suffix
...
dd: allow B as a suffix for count, seek, and skip
2022-11-19 12:23:43 +01:00
Sylvestre Ledru
0e3d3f780b
Merge pull request #4155 from miles170/issue-3779-fix-ci-freebsd
...
CI: fix FreeBSD CI passed when tests failed
2022-11-19 10:06:59 +01:00
Sylvestre Ledru
6d7850549b
Merge pull request #4150 from tertsdiepraam/stat-refactor
...
`stat` refactor
2022-11-19 09:57:23 +01:00
Jeffrey Finkelstein
701550d76b
dd: allow B as a suffix for count, seek, and skip
...
Allow uppercase "B" on its own as a unit specifier for the `count`,
`seek`, and `skip` arguments to `dd`.
For example,
$ printf "abcdef" | dd count=3B status=none
abc
2022-11-18 20:27:42 -05:00
Sylvestre Ledru
4d16132948
date: add a test for the issue 3780 to make sure we don't regress
2022-11-18 21:32:59 +01:00
Miles Liu
d748e3900b
test_cp: ignore failing tests for FreeBSD
2022-11-19 00:05:37 +08:00
Sylvestre Ledru
435ef5da8b
Merge pull request #4132 from tertsdiepraam/sort-accept-sort-mode-multiple-times
...
`sort`: allow a sort mode to appear multiple times
2022-11-17 21:43:28 +01:00
Terts Diepraam
33cbc94f25
rm: use uucore::prompt_yes over custom prompt function
2022-11-17 15:12:18 +01:00
Terts Diepraam
91df2b1709
mv: use uucore::prompt_yes over custom function
2022-11-17 15:11:19 +01:00
Terts Diepraam
7bb0e8f849
ln: use uucore::prompt_yes over custom function
2022-11-17 15:10:26 +01:00
Terts Diepraam
ed34264b95
cp: use uucore prompt_yes instead of custom
2022-11-17 15:09:34 +01:00
Sylvestre Ledru
c00fc0a8c4
Merge pull request #4146 from niyaznigmatullin/clippy_fix
...
Run `cargo +nightly clippy --fix`
2022-11-17 10:33:40 +01:00
Terts Diepraam
b0224e8145
stat: move unit tests to stat.rs instead of test_stat.rs
2022-11-16 21:17:39 +01:00
Terts Diepraam
7e5b6400e3
stat: use Flags struct instead of u8 bit manipulation
2022-11-16 21:12:40 +01:00
Niyaz Nigmatullin
fdd6a05259
chore: run cargo +nightly clippy --fix
2022-11-16 11:09:44 +02:00
Emil Suleymanov
a6c48b084c
test_cp: verify metadata for preserve no args case
2022-11-16 01:39:25 +01:00
Terts Diepraam
03c40b2db2
sort: allow a sort mode to appear multiple times
...
A test case for this is `sort -k 2n,2n` which should be accepted, because `n` is
compatible with itself.
Resolves issue #4129 .
2022-11-15 14:22:01 +01:00
Niyaz Nigmatullin
f73f686ca3
test_cp: temporarily disable non-working test on Android
2022-11-15 10:00:59 +02:00
Jeffrey Finkelstein
416a742e31
cp: use sparse copy on --sparse=always
...
Correct the behavior of `cp --reflink=never --sparse=always` so that
it performs a sparse copy. Before this commit, it was incorrectly
performing a dense copy.
2022-11-10 21:43:19 -05:00
Emil Suleymanov
1172a7e781
cp: remove interactive mode message on 'no' ( #4069 )
2022-11-10 12:45:18 +01:00
Sylvestre Ledru
9a5d18b8f6
Weird env variable names should trigger an error.
...
For example `env a=b=c printenv a=b` should fail
Tested by tests/misc/printenv.sh
2022-11-06 17:35:00 +01:00
Sylvestre Ledru
8e5c259e4b
Merge pull request #3966 from jfinkels/cp-backup-force
...
cp: force copying file to itself with --backup
2022-11-06 08:43:52 +01:00
Sylvestre Ledru
3ea7a061d7
Merge pull request #4097 from devnexen/fbsd_test_fix
...
fix cp tests build since they re supposed to be ignored on freebsd an…
2022-11-06 07:41:16 +01:00
Sylvestre Ledru
446df9da5a
Merge branch 'main' into cp-backup-force
2022-11-06 07:24:48 +01:00
Sylvestre Ledru
47e3149e85
Merge pull request #3978 from jfinkels/cp-copy-contents-fifo
...
cp: implement --copy-contents option for fifos
2022-11-06 07:23:25 +01:00
Jeffrey Finkelstein
5b100fef62
cp: implement --copy-contents option for fifos
...
Implement the `--copy-contents` option when the source is a FIFO, so
that the contents of the FIFO are copied (when the bytes become
available for reading) instead of the FIFO object itself. For example,
$ mkfifo fifo
$ cp --copy-contents fifo outfile &
[1] 1614080
$ echo foo > fifo
$ cat outfile
foo
[1]+ Done cp --copy-contents fifo outfile
2022-11-05 19:25:37 -04:00
Jeffrey Finkelstein
fbed01dd54
cp: force copying file to itself with --backup
...
Fix the behavior of `cp` when both `--backup` and `--force` are
specified and the source and destination are the same file. Before
this commit, `cp` terminated without copying and without making a
backup. After this commit, the copy is made and the backup file is
made. For example,
$ touch f
$ cp --force --backup f f
results in a backup file `f~` being created.
2022-11-05 19:23:50 -04:00
Sylvestre Ledru
6bc68cdcdf
Merge branch 'main' into refactor/add_nix_error_auto_conversion
2022-11-04 12:54:35 +01:00
Orhun Parmaksız
be49eb68f3
fix: address test failures
2022-11-04 13:35:54 +03:00
Daniel Hofstetter
8114abc956
Fix "needless borrow" clippy warning in env test
2022-11-04 11:10:35 +01:00
Sylvestre Ledru
2d79c4f693
Merge pull request #4091 from dmatos2012/allow-default-value-mktemp
...
mktemp: allow default missing value
2022-11-03 20:46:11 +01:00
Sylvestre Ledru
f60e861232
Merge pull request #4074 from jfinkels/cp-force-dangling-symlink
...
cp: restrict copy through dangling symlink with -f
2022-11-03 08:27:41 +01:00
David Matos
53c4b0b81e
mktemp: allow default missing value
2022-11-03 08:27:08 +01:00
David CARLIER
40b1ce7151
disable cp tests on FreeBSD where they are supposed to be ignored.
2022-11-03 08:25:40 +01:00
Daniel Hofstetter
2d4810b91b
numfmt: allow ' ' as field separator
2022-11-01 10:04:46 +01:00
Daniel Hofstetter
27c233f294
numfmt: allow "-" in field list
2022-10-31 14:53:41 +01:00
Sylvestre Ledru
b942054568
Merge pull request #4093 from cakebaker/numfmt_test_all_fields
...
numfmt: add test for "--field -" (all fields)
2022-10-31 11:01:32 +01:00
Terts Diepraam
ba3bb56041
Merge pull request #4013 from palaster/rm-correct-prompts
...
rm: rm3 now passes
2022-10-31 10:17:27 +01:00
Daniel Hofstetter
5d27c19853
numfmt: add test for "--field -" (all fields)
2022-10-31 09:26:28 +01:00
Sylvestre Ledru
bc126085c4
Merge branch 'main' into cp-force-dangling-symlink
2022-10-29 20:01:07 +02:00
Daniel Hofstetter
3a8feedf2d
numfmt: allow hyphen values for --field option
2022-10-29 16:50:41 +02:00
Sylvestre Ledru
b3af47a390
Merge branch 'main' into cp-force-dangling-symlink
2022-10-28 21:24:42 +02:00