tarka / xcp

An extended `cp`
GNU General Public License v3.0
745 stars 24 forks source link

xcp fails to copy from btrfs to exfat #26

Closed d3-X-t3r closed 2 years ago

d3-X-t3r commented 2 years ago

Copying a file from a btrfs source to an exfat destination fails with the error:

Error: Operation not supported (os error 95)

However, both cp and rsync have no issues copying the file. rsync with -P even displays the progress correctly.

xcp: 0.9.1 rust: 1.63.0-1 kernel: 5.18.18 OS: Fedora 36 Arch: x86_64

mateuszkj commented 2 years ago

I had similar error while coping from sshfs to glusterfs.

$ xcp -v aaa.gz /mnt/gluserfs/bbb/
12:44:17 [INFO] Copying source "aaa.gz" to "/mnt/gluserfs/bbb/"
12:44:17 [INFO] Worker: Copy "aaa.gz" -> "/mnt/gluserfs/bbb/aaa.gz"
12:44:17 [INFO] Worker received shutdown command.
Error: Operation not supported (os error 95)

$ echo $?
1

strace:

execve("/home/user/.cargo/bin/xcp", ["xcp", "-v", "aaa.gz", "/mnt/gluserfs/bbb/"...], 0x7ffde2ac12a8 /* 55 vars */) = 0
brk(NULL)                               = 0x55ac5bb9c000
arch_prctl(0x3001 /* ARCH_??? */, 0x7ffc503eb4d0) = -1 EINVAL (Zły argument)
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (Nie ma takiego pliku ani katalogu)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=148807, ...}) = 0
mmap(NULL, 148807, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2a3bb6d000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libgcc_s.so.1", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3405\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=104984, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2a3bb6b000
mmap(NULL, 107592, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2a3bb50000
mmap(0x7f2a3bb53000, 73728, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f2a3bb53000
mmap(0x7f2a3bb65000, 16384, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7f2a3bb65000
mmap(0x7f2a3bb69000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18000) = 0x7f2a3bb69000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220q\0\0\0\0\0\0"..., 832) = 832
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0{E6\364\34\332\245\210\204\10\350-\0106\343="..., 68, 824) = 68
fstat(3, {st_mode=S_IFREG|0755, st_size=157224, ...}) = 0
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0{E6\364\34\332\245\210\204\10\350-\0106\343="..., 68, 824) = 68
mmap(NULL, 140408, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2a3bb2d000
mmap(0x7f2a3bb33000, 69632, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7f2a3bb33000
mmap(0x7f2a3bb44000, 24576, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7f2a3bb44000
mmap(0x7f2a3bb4a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c000) = 0x7f2a3bb4a000
mmap(0x7f2a3bb4c000, 13432, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2a3bb4c000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\323\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=1369384, ...}) = 0
mmap(NULL, 1368336, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2a3b9de000
mmap(0x7f2a3b9eb000, 684032, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xd000) = 0x7f2a3b9eb000
mmap(0x7f2a3ba92000, 626688, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xb4000) = 0x7f2a3ba92000
mmap(0x7f2a3bb2b000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14c000) = 0x7f2a3bb2b000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \22\0\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0644, st_size=18848, ...}) = 0
mmap(NULL, 20752, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2a3b9d8000
mmap(0x7f2a3b9d9000, 8192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7f2a3b9d9000
mmap(0x7f2a3b9db000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f2a3b9db000
mmap(0x7f2a3b9dc000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3000) = 0x7f2a3b9dc000
close(3)                                = 0
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300A\2\0\0\0\0\0"..., 832) = 832
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32, 848) = 32
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\30x\346\264ur\f|Q\226\236i\253-'o"..., 68, 880) = 68
fstat(3, {st_mode=S_IFREG|0755, st_size=2029592, ...}) = 0
pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784
pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0", 32, 848) = 32
pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\30x\346\264ur\f|Q\226\236i\253-'o"..., 68, 880) = 68
mmap(NULL, 2037344, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2a3b7e6000
mmap(0x7f2a3b808000, 1540096, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f2a3b808000
mmap(0x7f2a3b980000, 319488, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19a000) = 0x7f2a3b980000
mmap(0x7f2a3b9ce000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1e7000) = 0x7f2a3b9ce000
mmap(0x7f2a3b9d4000, 13920, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2a3b9d4000
close(3)                                = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2a3b7e4000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2a3b7e2000
arch_prctl(ARCH_SET_FS, 0x7f2a3b7e5600) = 0
mprotect(0x7f2a3b9ce000, 16384, PROT_READ) = 0
mprotect(0x7f2a3b9dc000, 4096, PROT_READ) = 0
mprotect(0x7f2a3bb2b000, 4096, PROT_READ) = 0
mprotect(0x7f2a3bb4a000, 4096, PROT_READ) = 0
mprotect(0x7f2a3bb69000, 4096, PROT_READ) = 0
mprotect(0x55ac5b554000, 204800, PROT_READ) = 0
mprotect(0x7f2a3bbbf000, 4096, PROT_READ) = 0
munmap(0x7f2a3bb6d000, 148807)          = 0
set_tid_address(0x7f2a3b7e58d0)         = 1772177
set_robust_list(0x7f2a3b7e58e0, 24)     = 0
rt_sigaction(SIGRTMIN, {sa_handler=0x7f2a3bb33bf0, sa_mask=[], sa_flags=SA_RESTORER|SA_SIGINFO, sa_restorer=0x7f2a3bb41420}, NULL, 8) = 0
rt_sigaction(SIGRT_1, {sa_handler=0x7f2a3bb33c90, sa_mask=[], sa_flags=SA_RESTORER|SA_RESTART|SA_SIGINFO, sa_restorer=0x7f2a3bb41420}, NULL, 8) = 0
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
poll([{fd=0, events=0}, {fd=1, events=0}, {fd=2, events=0}], 3, 0) = 0 (Timeout)
rt_sigaction(SIGPIPE, {sa_handler=SIG_IGN, sa_mask=[PIPE], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7f2a3b829090}, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSEGV, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGSEGV, {sa_handler=0x55ac5b473210, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7f2a3bb41420}, NULL, 8) = 0
rt_sigaction(SIGBUS, NULL, {sa_handler=SIG_DFL, sa_mask=[], sa_flags=0}, 8) = 0
rt_sigaction(SIGBUS, {sa_handler=0x55ac5b473210, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0x7f2a3bb41420}, NULL, 8) = 0
sigaltstack(NULL, {ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=0}) = 0
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f2a3bb8f000
mprotect(0x7f2a3bb8f000, 4096, PROT_NONE) = 0
sigaltstack({ss_sp=0x7f2a3bb90000, ss_flags=0, ss_size=8192}, NULL) = 0
brk(NULL)                               = 0x55ac5bb9c000
brk(0x55ac5bbbd000)                     = 0x55ac5bbbd000
openat(AT_FDCWD, "/proc/self/maps", O_RDONLY|O_CLOEXEC) = 3
prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
read(3, "55ac5b2a7000-55ac5b2ea000 r--p 0"..., 1024) = 1024
read(3, "usr/lib/x86_64-linux-gnu/libc-2."..., 1024) = 1024
read(3, "000 08:02 4729252               "..., 1024) = 1024
read(3, "_64-linux-gnu/libgcc_s.so.1\n7f2a"..., 1024) = 1024
read(3, "      /usr/lib/x86_64-linux-gnu/"..., 1024) = 527
close(3)                                = 0
sched_getaffinity(1772177, 32, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31]) = 8
getrandom(0x7ffc503e7fe0, 16, 0x4 /* GRND_??? */) = -1 EINVAL (Zły argument)
getrandom("\x5c\x87\x7b\x6c\xde\x21\x3e\x48\x60\x5b\xe2\x2f\x58\x96\xf3\xbd", 16, GRND_NONBLOCK) = 16
statx(0, NULL, AT_STATX_SYNC_AS_STAT, STATX_ALL, NULL) = -1 EFAULT (Błędny adres)
statx(AT_FDCWD, "/mnt/gluserfs/bbb/", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=1183744, ...}) = 0
write(1, "12:45:41 \33[0m\33[34m[INFO] \33[0mCop"..., 12912:45:41 [INFO] Copying source "aaa.gz" to "/mnt/gluserfs/bbb/"
) = 129
statx(AT_FDCWD, "aaa.gz", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=39876, ...}) = 0
statx(AT_FDCWD, "aaa.gz", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFREG|0755, stx_size=39876, ...}) = 0
statx(AT_FDCWD, "/mnt/gluserfs/bbb/", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=1183744, ...}) = 0
statx(AT_FDCWD, "/mnt/gluserfs/bbb/", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_BASIC_STATS, stx_attributes=0, stx_mode=S_IFDIR|0755, stx_size=1183744, ...}) = 0
ioctl(2, TCGETS, {B38400 opost isig icanon echo ...}) = 0
futex(0x7f2a3b9dd0c8, FUTEX_WAKE_PRIVATE, 2147483647) = 0
mmap(NULL, 2101248, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f2a3b5e1000
mprotect(0x7f2a3b5e2000, 2097152, PROT_READ|PROT_WRITE) = 0
clone(child_stack=0x7f2a3b7e0df0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tid=[1772179], tls=0x7f2a3b7e1700, child_tidptr=0x7f2a3b7e19d0) = 1772179
mmap(NULL, 2101248, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f2a3b3e0000
mprotect(0x7f2a3b3e1000, 2097152, PROT_READ|PROT_WRITE) = 0
clone(child_stack=0x7f2a3b5dfdf0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tid=[1772180], tls=0x7f2a3b5e0700, child_tidptr=0x7f2a3b5e09d0) = 1772180
mmap(NULL, 2101248, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f2a3b1df000
mprotect(0x7f2a3b1e0000, 2097152, PROT_READ|PROT_WRITE) = 0
clone(child_stack=0x7f2a3b3dedf0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tid=[1772181], tls=0x7f2a3b3df700, child_tidptr=0x7f2a3b3df9d0) = 1772181
mmap(NULL, 2101248, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f2a3afde000
mprotect(0x7f2a3afdf000, 2097152, PROT_READ|PROT_WRITE) = 0
clone(child_stack=0x7f2a3b1dddf0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tid=[1772182], tls=0x7f2a3b1de700, child_tidptr=0x7f2a3b1de9d0) = 1772182
mmap(NULL, 2101248, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7f2a3addd000
mprotect(0x7f2a3adde000, 2097152, PROT_READ|PROT_WRITE) = 0
clone(child_stack=0x7f2a3afdcdf0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tid=[1772183], tls=0x7f2a3afdd700, child_tidptr=0x7f2a3afdd9d0) = 1772183
sched_yield()                           = 0
sched_yield()                           = 0
sched_yield(12:45:41 [INFO] Worker: Copy "aaa.gz" -> "/mnt/gluserfs/bbb/aaa.gz"
)                           = 0
12:45:41 [INFO] Worker received shutdown command.
sched_yield()                           = 0
sched_yield()                           = 0
sched_yield()                           = 0
sched_yield()                           = 0
sched_yield()                           = 0
futex(0x55ac5bb9c988, FUTEX_WAIT_BITSET_PRIVATE, 4294967295, NULL, FUTEX_BITSET_MATCH_ANY) = 0
futex(0x55ac5bb9d840, FUTEX_WAKE_PRIVATE, 2147483647) = 0
write(2, "Error: ", 7Error: )                  = 7
write(2, "Operation not supported", 23Operation not supported) = 23
write(2, " (os error ", 11 (os error )             = 11
write(2, "95", 295)                       = 2
write(2, ")", 1))                        = 1
write(2, "\n", 1
)                       = 1
sigaltstack({ss_sp=NULL, ss_flags=SS_DISABLE, ss_size=8192}, NULL) = 0
munmap(0x7f2a3bb8f000, 12288)           = 0
exit_group(1)                           = ?
+++ exited with 1 +++

Command works with enabled option --no-perms.

tarka commented 2 years ago

This appears to be an issue with copying xattrs where the target FS doesn't support them. I've released version 0.9.2 with a workaround.