Subject: bug#8767: cp: --preserve=all doesn't work for the parents when --parent is used

From: Jim Meyering <[email-masked]>
Date: Tue, 13 Sep 2011 14:27:26 +0200

tags 8767 + moreinfo
thanks

Ondrej Vasik wrote:
> On Tue, 2011-05-31 at 15:20 +0200, Christoph Anton Mitterer wrote:
>> On Tue, 2011-05-31 at 09:42 +0200, Ondrej Vasik wrote:
>> > Could you please specify coreutils version where you experience the
>> > issue?
>> Sorry, forgot that.
>> This was the corutils from Debian sid, which is currently 8.5.
>
> Thanks for specifying that ... current version is 8.12, but I think the
> support in 8.5 was ready enough.
>
>> > but in the case of extended attributes and
>> > SELinux context possible failure of preserving these attributes doesn't
>> > change exit status.
>> Oh that's bad,.. why?
>
> Because preserve=all and -a is too general and some filesystems might
> not have support for it. Therefore failure might break old scripts.
> Failures might be quite wordy, in addition. So cp -a / cp
> --preserve=all /mv just tries to preserve as much as possible.
>
> http://lists.gnu.org/archive/html/bug-coreutils/2009-04/msg00174.html
> http://lists.gnu.org/archive/html/bug-coreutils/2010-03/msg00268.html
> http://lists.gnu.org/archive/html/bug-coreutils/2010-04/msg00039.html
>
> When you explicitly mention the attribute, you probably really want it,
> so failure changes the exit status.
>
>> Can I get this behavious by using --preserve=context,xattr,all to REALLY
>> preserve everything and get errors if this didn't work.
>
> Yes, preserve=context,xattr,all should make these attributes required.
>
>> > please try if using --preserve=xattr
>> > shows an error.
>> I did, but no error, no preservation.
>> Also it's on the same filesystem (with user_xattr enabled,.. so there
>> should be no problem).
>
> Ok, so it should not be caused by filesystem... could you please check
> the strace of the cp for (f/l)getxattr?
>
> Greetings,
>          Ondrej

Hi Christoph,

If this is still a problem for you,
would you please provide strace output?
If not, please let us know (and why!) and I'll close this ticket.