[issue14082] shutil doesn't copy extended attributes

Hynek Schlawack report at bugs.python.org
Fri Apr 6 11:52:18 CEST 2012


Hynek Schlawack <hs at ox.cx> added the comment:

This ticket has a small catch:

There are several namespaces. According to http://en.wikipedia.org/wiki/Xattr#Linux :

- user: can be set by anyone
- trusted: root only
- security: root only
- system: even root can’t do that, at least not in my vm

I’m writing a shutil.copyxattr() first which could simple get another argument for the namespaces that should be copied.

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.

So I’d suggest:

- copyxattr has an extra argument called namespaces with default being ['user'], so that in theory someone who wants to do something more sophisticated can do it.
- copy2 copies only user.* though because that’s what you usually want.

Please let me know what you think about it.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14082>
_______________________________________


More information about the Python-bugs-list mailing list