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 twouters
Recipients twouters
Date 2013-01-29.18:18:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The new xattr support in shutil causes shutil.copytree and shutil.copy2 to fail inelegantly on (source) filesystems that do not support xattrs (like NFS):

# /home/twouters does not support xattrs
>>> os.listxattr("/home/twouters/foo")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 95] Operation not supported: '/home/twouters/foo'

>>> shutil.copytree("/home/twouters/spam", "/tmp/spam")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/twouters/gvs-pristine/python/Python-3.Lib/", line 345, in copytree
    raise Error(errors)
shutil.Error: [('/home/twouters/spam/ham', '/tmp/spam/ham', "[Errno 95] Operation not supported: '/home/twouters/spam/ham'"), ('/home/twouters/spam/eggs', '/tmp/spam/eggs', "[Errno 95] Operation not supported: '/home/twouters/spam/eggs'"), ('/home/twouters/spam', '/tmp/spam', "[Errno 95] Operation not supported: '/home/twouters/spam'")]

(The actual files will have been copied, since xattr copies are done after everything else.)  Interestingly shutil._copyxattr does try to cope with unsupported xattrs on the *target* filesystem (which seems like it might be a mistake to do, since it loses data), just not the original filesystem (which seems like a sensible thing instead):

# /tmp does support xattrs
>>> os.listxattr("/tmp/spam")
>>> shutil.copytree("/tmp/spam", "/home/twouters/spam-new")

The attached patch fixes shutil._copyxattr to also ignore unsupported/empty xattrs (but not permission errors) on the source. (I'm not certain if errno.ENODATA can be expected from os.listxattr(), but internet searches suggest that some people think so, and I don't know what other meaning it could have.)
Date User Action Args
2013-01-29 18:18:12twouterssetrecipients: + twouters
2013-01-29 18:18:12twouterssetmessageid: <>
2013-01-29 18:18:12twouterslinkissue17076 messages
2013-01-29 18:18:12twouterscreate