This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients Arfrever, benjamin.peterson, eric.araujo, hynek, neologix, pitrou
Date 2012-04-09.21:10:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1334005492.3379.50.camel@localhost.localdomain>
In-reply-to <1333705938.64.0.743606507616.issue14082@psf.upfronthosting.co.za>
Content
> I’m writing a shutil.copyxattr() first which could simple get another
> argument for the namespaces that should be copied.

Sounds good to me :-)

> However what to do inside copy2()?
> 
> I’m tending to either:
> 
> 1. copy only user.*
> 2. ignore errors in any namespace != user
> 
> Personally, I find the second approach rather non-deterministic.

But it's also more practical, e.g. when running as root you would
probably be surprised if only a subset of xattrs get copied, wouldn't
you? “Practicality beats purity.”

For reference, here is part of the documentation for GNU cp's "-a"
option:

`-a'
`--archive'
     Preserve as much as possible of the structure and attributes of the
     original files in the copy (but do not attempt to preserve internal
     directory structure; i.e., `ls -U' may list the entries in a copied
     directory in a different order).  Try to preserve SELinux security
     context and extended attributes (xattr), but ignore any failure to
     do that and print no corresponding diagnostic.  Equivalent to `-dR
     --preserve=all' with the reduced diagnostics.

Meaning that "cp -a" tries to copy all xattrs and silences errors when
it's not possible to do so.

"cp --preserve=all" seems to have a similar error-silencing behaviour:

    `all'
          Preserve all file attributes.  Equivalent to specifying all
          of the above, but with the difference that failure to
          preserve SELinux security context or extended attributes does
          not change `cp''s exit status.  In contrast to `-a', all but
          `Operation not supported' warnings are output.
History
Date User Action Args
2012-04-09 21:10:22pitrousetrecipients: + pitrou, benjamin.peterson, eric.araujo, Arfrever, neologix, hynek
2012-04-09 21:10:22pitroulinkissue14082 messages
2012-04-09 21:10:21pitroucreate