Daniel Hofstetter
fcb7185279
Disable "broken intra doc links" lint
2022-08-12 14:48:59 +02:00
Daniel Hofstetter
689000576b
du: remove useless transmute to fix clippy warning
2022-08-12 10:56:13 +02:00
Daniel Hofstetter
898914b6fb
touch: remove transmute to fix clippy warning
2022-08-12 10:54:59 +02:00
Daniel Hofstetter
dd19f85d2b
Fix clippy warnings in tests
2022-08-12 09:45:16 +02:00
Daniel Hofstetter
bfa6e23166
numfmt: implement Eq to fix clippy warning
2022-08-12 07:49:05 +02:00
Sylvestre Ledru
0f1b98c259
Merge pull request #3804 from cakebaker/clap_replace_deprecated_values_of
...
Replace deprecated values_of() with get_many()
2022-08-11 15:08:25 +02:00
Daniel Hofstetter
c0c26c4c58
Replace deprecated values_of() with get_many()
2022-08-11 13:49:09 +02:00
Terts Diepraam
a27e011259
Merge pull request #3802 from sylvestre/clippy5
...
Fix some clippy warnings
2022-08-11 12:54:41 +02:00
Sylvestre Ledru
a2e0296ef2
remove some unnecessary parentheses
2022-08-10 22:58:27 +02:00
Sylvestre Ledru
9f1219005d
fix the significant_drop_in_scrutinee clippy warning
2022-08-10 21:37:48 +02:00
Sylvestre Ledru
8692301ec7
Merge pull request #3754 from ackerleytng/main
...
Add `parse_glob` module and update `du` to use `parse_glob`
2022-08-10 19:28:40 +02:00
Sylvestre Ledru
e304758f61
Merge pull request #3801 from niyaznigmatullin/sort_wait_for_signal_handling
...
sort: wait when SIGINT was raised for the program to finish properly
2022-08-10 19:26:50 +02:00
Terts Diepraam
c483a147cc
Merge pull request #3788 from niyaznigmatullin/touch_trailing_slashes_no_create
...
touch: trailing slashes handling
2022-08-10 18:48:41 +02:00
Niyaz Nigmatullin
898be12a33
sort: add comments to wait_if_signal function and its usage
2022-08-10 15:31:03 +03:00
Niyaz Nigmatullin
e43872d4c7
sort: rename lock binding variable
2022-08-10 12:20:25 +03:00
Niyaz Nigmatullin
50f1e9a5fa
sort: fix test_tmp_files_deleted_on_sigint, wait for signal handling at
...
the end of the program
2022-08-10 12:15:27 +03:00
Niyaz Nigmatullin
ca6b4ca7de
test/touch: fix tests for Windows and MacOS
2022-08-10 11:07:22 +03:00
Niyaz Nigmatullin
7e1c6d1baf
tests/touch: add tests for trailing slashes + -c
2022-08-10 11:07:22 +03:00
Niyaz Nigmatullin
13e912bcbd
touch: fix error handling
2022-08-10 11:07:22 +03:00
Ackerley Tng
c2bb9596d9
du: update du to use parse_glob::from_str
2022-08-09 10:36:23 +02:00
Ackerley Tng
898689d924
du: refactor pattern building in du
2022-08-09 10:36:23 +02:00
Ackerley Tng
defde8c91e
uucore: add parse_glob module
2022-08-09 10:36:23 +02:00
Sylvestre Ledru
33e4b96675
Merge pull request #3799 from jhscheer/patch-8
...
README: add badge for MSRV
2022-08-09 10:34:08 +02:00
Jan Scheer
f6ecf30f35
README: add badge for MSRV
...
* add badge for MSRV
* use the term "Minimum Supported Rust Version (MSRV)"
2022-08-09 10:02:13 +02:00
Sylvestre Ledru
87415f063d
Merge pull request #3781 from niyaznigmatullin/disable_max_value_tests
...
disable numfmt and printf LONG_MIN and INT_MAX+1 gnu-tests
2022-08-09 09:48:15 +02:00
Niyaz Nigmatullin
5978185f94
fix spelling
2022-08-09 08:35:10 +03:00
Niyaz Nigmatullin
dbaff49de6
gnu-tests: disable some tests that implementation-specific
2022-08-09 08:35:10 +03:00
Sylvestre Ledru
ab791b6c0b
Merge pull request #3796 from niyaznigmatullin/fix_broken_pipe_test_positive_zero_lines
...
test/tail: ignore broken pipe for tail -n 0
2022-08-09 00:24:32 +02:00
Sylvestre Ledru
2a6371fff8
Merge pull request #3797 from niyaznigmatullin/fix_broken_pipe_test_bytes_oseek_bytes_trunc_oflag
...
test/dd: fix broken pipe in test_bytes_oseek_bytes_trunc_oflag
2022-08-09 00:17:06 +02:00
Niyaz Nigmatullin
161fc6b642
test/dd: add ignore_stdin_write_error, because count=0 and dd doesn't
...
read anything
2022-08-08 22:44:59 +03:00
Niyaz Nigmatullin
04df57ebd4
test/tail: ignore pipe errors when tail -n 0, since it doesn't read
...
anything
2022-08-08 22:29:53 +03:00
Sylvestre Ledru
5b2313de78
Merge pull request #3792 from uutils/dependabot/cargo/unindent-0.1.10
...
build(deps): bump unindent from 0.1.9 to 0.1.10
2022-08-08 19:31:12 +02:00
Niyaz Nigmatullin
fee851dc1c
test/cp: fix test_copy_through_dangling_symlink_no_dereference_permissions ( #3789 )
...
* test/cp: -p changes ctime and added sleep for better timestamp testing
* test/cp: add nanoseconds checking for copied timestamps
* test/cp: made compilable on other OSes
* test/cp: added error messages to assert_eq calls
2022-08-08 11:11:17 +02:00
dependabot[bot]
35510ae073
build(deps): bump unindent from 0.1.9 to 0.1.10
...
Bumps [unindent](https://github.com/dtolnay/indoc ) from 0.1.9 to 0.1.10.
- [Release notes](https://github.com/dtolnay/indoc/releases )
- [Commits](https://github.com/dtolnay/indoc/compare/0.1.9...0.1.10 )
---
updated-dependencies:
- dependency-name: unindent
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 09:02:56 +00:00
Sylvestre Ledru
175f8aa16f
Merge pull request #3791 from uutils/dependabot/cargo/ouroboros-0.15.2
...
build(deps): bump ouroboros from 0.15.0 to 0.15.2
2022-08-08 11:01:09 +02:00
dependabot[bot]
54840b5fe1
build(deps): bump ouroboros from 0.15.0 to 0.15.2
...
Bumps [ouroboros](https://github.com/joshua-maros/ouroboros ) from 0.15.0 to 0.15.2.
- [Release notes](https://github.com/joshua-maros/ouroboros/releases )
- [Commits](https://github.com/joshua-maros/ouroboros/commits )
---
updated-dependencies:
- dependency-name: ouroboros
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 06:30:58 +00:00
Sylvestre Ledru
b3d92ddf03
Merge pull request #3776 from jhscheer/patch-7
...
build-gnu: attempt to fix #3765
2022-08-06 20:49:12 +02:00
Sylvestre Ledru
2e0ed71bce
Merge pull request #3782 from koutheir/main
...
Use `u64` instead of `ino_t`/`dev_t` types
2022-08-06 20:44:55 +02:00
Koutheir Attouchi
81a762ced6
Use u64
instead of ino_t
/dev_t
types
2022-08-06 02:50:19 -04:00
Sylvestre Ledru
774c3f8f60
Merge pull request #3777 from jhscheer/fix_3733
...
tests: fix Freebsd test failures
2022-08-05 09:26:20 +02:00
Jan Scheer
0555745052
tests: fix Freebsd test failures
2022-08-05 08:04:25 +02:00
Jan Scheer
39505e39ed
build-gnu: attempt to fix #3765
2022-08-05 07:33:36 +02:00
Terts Diepraam
fa47af73d0
Merge pull request #3774 from sylvestre/consistency
...
Add more consistency in the --help output and declarations
2022-08-04 23:53:51 +02:00
Sylvestre Ledru
68647d3082
Merge pull request #3773 from uutils/sylvestre-patch-2
...
Remove manpages from the spell list ignore
2022-08-04 21:55:14 +02:00
Sylvestre Ledru
d957a11f34
Add more consistency in the --help output and declarations
2022-08-04 21:53:27 +02:00
Sylvestre Ledru
9b28debd50
Merge pull request #3771 from cakebaker/clap_replace_deprecated_possible_values
...
Replace possible_values() with value_parser()
2022-08-04 21:52:24 +02:00
Sylvestre Ledru
fcef8676f7
Remove manpages from the spell list ignore
2022-08-04 17:58:25 +02:00
Daniel Hofstetter
07b218e55a
Replace possible_values() with value_parser()
2022-08-04 14:38:10 +02:00
Pierre Marsais
e1991525af
cp: Implement --sparse
flag ( #3766 )
...
* cp: Refactor `reflink`/`sparse` handling to enable `--sparse` flag
`--sparse` and `--reflink` options have a lot of similarities:
- They have similar options (`always`, `never`, `auto`)
- Both need OS specific handling
- They can be mutually exclusive
Prior to this change, `sparse` was defined as `CopyMode`, but `reflink`
wasn't. Given the similarities, it makes sense to handle them similarly.
The idea behind this change is to move all OS specific file copy
handling in the `copy_on_write_*` functions. Those function then
dispatch to the correct logic depending on the arguments (at the moment,
the tuple `(reflink, sparse)`).
Also, move the handling of `--reflink=never` from `copy_file` to the
`copy_on_write_*` functions, at the cost of a bit of code duplication,
to allow `copy_on_write_*` to handle all cases (and later handle
`--reflink=never` with `--sparse`).
* cp: Implement `--sparse` flag
This begins to address #3362
At the moment, only the `--sparse=always` logic matches the requirement
form GNU cp info page, i.e. always make holes in destination when
possible.
Sparse copy is done by copying the source to the destination block by
block (blocks being of the destination's fs block size). If the block
only holds NUL bytes, we don't write to the destination.
About `--sparse=auto`: according to GNU cp info page, the destination
file will be made sparse if the source file is sparse as well. The next
step are likely to use `lseek` with `SEEK_HOLE` detect if the source
file has holes. Currently, this has the same behaviour as
`--sparse=never`. This `SEEK_HOLE` logic can also be applied to
`--sparse=always` to improve performance when copying sparse files.
About `--sparse=never`: from my understanding, it is not guaranteed that
Rust's `fs::copy` will always produce a file with no holes, as
["platform-specific behavior may change in the
future"](https://doc.rust-lang.org/std/fs/fn.copy.html#platform-specific-behavior )
About other platforms:
- `macos`: The solution may be to use `fcntl` command `F_PUNCHHOLE`.
- `windows`: I only see `FSCTL_SET_SPARSE`.
This should pass the following GNU tests:
- `tests/cp/sparse.sh`
- `tests/cp/sparse-2.sh`
- `tests/cp/sparse-extents.sh`
- `tests/cp/sparse-extents-2.sh`
`sparse-perf.sh` needs `--sparse=auto`, and in particular a way to skip
holes in the source file.
Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2022-08-04 13:22:59 +02:00
Pierre Marsais
90a9829287
cp: truncate destination when --reflink
is set ( #3759 )
...
* cp: truncate destination when `--reflink` is set
This is needed in order to allow overriding an existing file.
```
$ truncate -s 512M /tmp/disk.img
$ mkfs.btrfs /tmp/disk.img
[...]
$ mkdir /tmp/disk
$ sudo mount /tmp/disk.img /tmp/disk
$ sudo chown $(id -u):$(id -g) -R /tmp/disk
$ for i in $(seq 0 8192); do echo -ne 'a' >>/tmp/disk/src1; done
$ echo "success" >/tmp/disk/src2
$
$ # GNU ls supports overriding files created with `--reflink`
$ cp --reflink=always /tmp/disk/src1 /tmp/disk/dst1
$ cp --reflink=always /tmp/disk/src2 /tmp/disk/dst1
$ cat /tmp/disk/dst1
success
$
$ # Now testing with uutils
$ cargo run cp --reflink=always /tmp/disk/src1 /tmp/disk/dst2
Finished dev [unoptimized + debuginfo] target(s) in 0.25s
Running `target/debug/coreutils cp --reflink=always /tmp/disk/src1 /tmp/disk/dst2`
$ cargo run cp --reflink=always /tmp/disk/src2 /tmp/disk/dst2
Finished dev [unoptimized + debuginfo] target(s) in 0.26s
Running `target/debug/coreutils cp --reflink=always /tmp/disk/src2 /tmp/disk/dst2`
cp: failed to clone "/tmp/disk/src2" from "/tmp/disk/dst2": Invalid argument (os error 22)
$ cat /tmp/disk/dst2
[lots of 'a']
$
$ # With truncate(true)
$ cargo run cp --reflink=always /tmp/disk/src1 /tmp/disk/dst3
Finished dev [unoptimized + debuginfo] target(s) in 7.98s
Running `target/debug/coreutils cp --reflink=always /tmp/disk/src1 /tmp/disk/dst3`
$ cargo run cp --reflink=always /tmp/disk/src2 /tmp/disk/dst3
Finished dev [unoptimized + debuginfo] target(s) in 0.27s
Running `target/debug/coreutils cp --reflink=always /tmp/disk/src2 /tmp/disk/dst3`
$ cat /tmp/disk/dst3
success
```
2022-08-04 08:50:19 +02:00