Hi, thanks for report... Ernest N. Mamikonyan wrote: > Cp(1) doesn't correctly copy extended attributes for read-only files: > > touch foo > setfattr -n user.key -v value foo > chmod a-w foo > cp --preserve=xattr foo bar > cp: setting attribute `user.key' for `user.key': Permission denied
This error message is not produced by coreutils sources, but by libattr
- all messages about extended attributes are generated there. I'm not
sure why they are trying to set attributes for source file - maybe they
are not and access rights for destination file are more relevant.
Strace/ltrace of the failure could be helpful as well.
> If one uses "cp -a" instead, it simply strips the metadata and doesn't
> complain.
cp -a shouldn't complain, but the xattrs are likely not preserved in
this case - just error message from xattr preservation is suppressed and
not preserving extended attributes is not considered as error in that
case.
Greetings,
Ondřej Vašík
signature.asc
Description: Toto je digitálně podepsaná část zprávy
