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

From: Ondrej Vasik <[email-masked]>
Date: Tue, 31 May 2011 16:41:53 +0200

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