Skip to content
Permalink
Browse files

bpo-24564: shutil.copystat(): ignore EINVAL on os.setxattr() (GH-13369)

(cherry picked from commit a16387a)

Co-authored-by: Ying Wang <me@yingw787.com>
  • Loading branch information...
2 people authored and giampaolo committed May 30, 2019
1 parent 3a98bbf commit f1487b323549e2360460383b4304f6592fb38e27
Showing with 6 additions and 2 deletions.
  1. +3 −2 Lib/shutil.py
  2. +3 −0 Misc/NEWS.d/next/Library/2019-05-16-23-40-36.bpo-24564.lIwV_7.rst
@@ -156,15 +156,16 @@ def _copyxattr(src, dst, *, follow_symlinks=True):
try:
names = os.listxattr(src, follow_symlinks=follow_symlinks)
except OSError as e:
if e.errno not in (errno.ENOTSUP, errno.ENODATA):
if e.errno not in (errno.ENOTSUP, errno.ENODATA, errno.EINVAL):
raise
return
for name in names:
try:
value = os.getxattr(src, name, follow_symlinks=follow_symlinks)
os.setxattr(dst, name, value, follow_symlinks=follow_symlinks)
except OSError as e:
if e.errno not in (errno.EPERM, errno.ENOTSUP, errno.ENODATA):
if e.errno not in (errno.EPERM, errno.ENOTSUP, errno.ENODATA,
errno.EINVAL):
raise
else:
def _copyxattr(*args, **kwargs):
@@ -0,0 +1,3 @@
:func:`shutil.copystat` now ignores :const:`errno.EINVAL` on :func:`os.setxattr` which may occur when copying files on filesystems without extended attributes support.

Original patch by Giampaolo Rodola, updated by Ying Wang.

0 comments on commit f1487b3

Please sign in to comment.
You can’t perform that action at this time.