Subject: Re: bug#48833: reflink copying does not check/set No_COW attribute and fail

From: Paul Eggert <[email-masked]>
Date: Sun, 6 Jun 2021 22:47:05 -0700

On 6/5/21 10:42 PM, Zygo Blaxell wrote:
> If cp -a implements the inode attribute propagation (or inheritance), then
> only users of cp -a are impacted.  They are more likely to be aware that
> they may be creating new files with reduced-integrity storage attributes.

True, although I think this aspect of attribute-copying will typically 
come as a surprise even to "cp -a" users.

> If the file is empty, you can chattr +C or -C.  If the file is not
> empty, chattr fails with an error.

Although coreutils 'cp -a' currently truncates any already-existing 
output file (by opening it with O_TRUNC), it then calls copy_file_range 
before calling fsetxattr on the destination. Presumably cp should do the 
equivalent of chattr +C before doing the copy_file_range stuff. (Perhaps 
you've already mentioned this point; if so, my apologies for the 
duplication.)