[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#56391: `cp --reflink=always` creates empty file on failure
From: |
Paul Eggert |
Subject: |
bug#56391: `cp --reflink=always` creates empty file on failure |
Date: |
Wed, 6 Jul 2022 14:48:33 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 |
On 7/6/22 06:17, Pádraig Brady wrote:
This will usually work, but there are cases where this may lose data,
as previously discussed at:
https://bugzilla.redhat.com/show_bug.cgi?id=921708
http://lists.gnu.org/archive/html/coreutils/2013-03/msg00056.html
I'm not sure cp can robustly clean up in this situation?
Thanks for pointing me to those old discussions. As I understand it, the
worry is that FICLONE will only partly succeed, causing the destination
file to contain some (but not all) the input data, and then if we remove
the output file we'll lose the newly-made partial clone. I don't know
whether FICLONE can do that, but it sounds like a reasonable worry.
If that understanding is correct, then the attached further patch should
suffice, so I boldly installed it.
0001-cp-don-t-remove-nonempty-cloned-dest.patch
Description: Text Data