I was reading the code and I noticed that the plain read/write loop can have an incorrect lseek offset after EINTR. This is the fix: --- a/src/portage_util_file_copy_reflink_linux.c +++ b/src/portage_util_file_copy_reflink_linux.c @@ -328,7 +328,7 @@ _reflink_linux_file_copy(PyObject *self, PyObject *args) * correct state, in case an EINTR retry caused it to * get out of sync somewhow. */ - } else if (lseek(fd_in, offset_out, SEEK_SET) < 0) { + } else if (lseek(fd_in, offset_out + buf_bytes, SEEK_SET) < 0) { error = errno; } else { while (1) {
Patch sent for review: https://archives.gentoo.org/gentoo-portage-dev/message/a4e957a4ab9253a98760167a83f3e0e9 https://github.com/gentoo/portage/pull/163
This is in the master branch: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a3c87da25dc1944e6b7720e304318ae5474dff95
Fixed in 2.3.6.