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

Previous Next

Package: coreutils;

Reported by: Christoph Anton Mitterer <calestyo <at> scientia.net>

Date: Mon, 30 May 2011 22:50:03 UTC

Severity: normal

Tags: moreinfo

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8767 in the body.
You can then email your comments to 8767 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8767; Package coreutils. (Mon, 30 May 2011 22:50:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christoph Anton Mitterer <calestyo <at> scientia.net>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 30 May 2011 22:50:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Christoph Anton Mitterer <calestyo <at> scientia.net>
To: <bug-coreutils <at> gnu.org>
Subject: cp: --preserve=all doesn't work for the parents when --parent is used
Date: Mon, 30 May 2011 22:43:02 +0000
Hi.

When doing something like:
cp --no-dereference --preserve=all --parents --no-clobber "${pathname}"
"${destination}"

Then the file (if it's not a directory) will be copied to
${destination}/${pathname} including all the directories within ${pathname}
(e.g. ./foo/bar/file).
While the owner (user/group) and file permission bits of foo and bar seem
to be preserved, the XATTRs are not (maybe the other preserve-classes are
also not preserved).


Doubt that this is desired, so I guess it's a bug.


Cheers,
Chris.




Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8767; Package coreutils. (Tue, 31 May 2011 07:43:02 GMT) Full text and rfc822 format available.

Message #8 received at 8767 <at> debbugs.gnu.org (full text, mbox):

From: Ondrej Vasik <ovasik <at> redhat.com>
To: Christoph Anton Mitterer <calestyo <at> scientia.net>
Cc: 8767 <at> debbugs.gnu.org
Subject: Re: bug#8767: cp: --preserve=all doesn't work for the parents when
	--parent is used
Date: Tue, 31 May 2011 09:42:38 +0200
On Mon, 2011-05-30 at 22:43 +0000, Christoph Anton Mitterer wrote:
> Hi.
> 
> When doing something like:
> cp --no-dereference --preserve=all --parents --no-clobber "${pathname}"
> "${destination}"
> 
> Then the file (if it's not a directory) will be copied to
> ${destination}/${pathname} including all the directories within ${pathname}
> (e.g. ./foo/bar/file).
> While the owner (user/group) and file permission bits of foo and bar seem
> to be preserved, the XATTRs are not (maybe the other preserve-classes are
> also not preserved).
> 
> 
> Doubt that this is desired, so I guess it's a bug.

Could you please specify coreutils version where you experience the
issue?

--preserve=all tries to preserve all possible things which could be
preserved with --preserve , but in the case of extended attributes and
SELinux context possible failure of preserving these attributes doesn't
change exit status. This is described in info documentation. If it
doesn't show any error message, please try if using --preserve=xattr
shows an error. Additionally, strace of the failed preservation and
information about destination filesystem might help too.

Greetings,
         Ondrej Vasik







Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8767; Package coreutils. (Tue, 31 May 2011 13:21:02 GMT) Full text and rfc822 format available.

Message #11 received at 8767 <at> debbugs.gnu.org (full text, mbox):

From: Christoph Anton Mitterer <calestyo <at> scientia.net>
To: ovasik <at> redhat.com
Cc: 8767 <at> debbugs.gnu.org
Subject: Re: bug#8767: cp: --preserve=all doesn't work for the parents when
	--parent is used
Date: Tue, 31 May 2011 15:20:03 +0200
[Message part 1 (text/plain, inline)]
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.


> 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?
Can I get this behavious by using --preserve=context,xattr,all to REALLY
preserve everything and get errors if this didn't work.

> 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).
[smime.p7s (application/x-pkcs7-signature, attachment)]

Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8767; Package coreutils. (Tue, 31 May 2011 14:43:01 GMT) Full text and rfc822 format available.

Message #14 received at 8767 <at> debbugs.gnu.org (full text, mbox):

From: Ondrej Vasik <ovasik <at> redhat.com>
To: Christoph Anton Mitterer <calestyo <at> scientia.net>
Cc: 8767 <at> debbugs.gnu.org
Subject: Re: bug#8767: cp: --preserve=all doesn't work for the parents when
	--parent is used
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





Information forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#8767; Package coreutils. (Tue, 13 Sep 2011 12:33:01 GMT) Full text and rfc822 format available.

Message #17 received at 8767 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Christoph Anton Mitterer <calestyo <at> scientia.net>
Cc: 8767 <at> debbugs.gnu.org, ovasik <at> redhat.com
Subject: Re: bug#8767: cp: --preserve=all doesn't work for the parents when
	--parent is used
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.




Added tag(s) moreinfo. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 11 Oct 2018 22:35:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 8767 <at> debbugs.gnu.org and Christoph Anton Mitterer <calestyo <at> scientia.net> Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 11 Oct 2018 22:35:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 09 Nov 2018 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 284 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.