You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue seems to be related to the use of truncate(false) for the destination of the copy when --reflink is present. My understanding of Rust documentation is that we want to truncate the file.
Below is an example comparing GNU cp to uutils cp:
$ 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 --version
cp (GNU coreutils) 9.1
[...]
$ 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']
The text was updated successfully, but these errors were encountered:
The issue seems to be related to the use of
truncate(false)
for the destination of the copy when--reflink
is present. My understanding of Rust documentation is that we want to truncate the file.Below is an example comparing GNU
cp
to uutilscp
:The text was updated successfully, but these errors were encountered: