Antoine Pitrou <pit...@free.fr> added the comment: > 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14082> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com