0
0
mirror of https://github.com/python/cpython.git synced 2024-11-24 00:38:00 +01:00

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

This commit is contained in:
Ying Wang 2019-05-29 23:25:31 -04:00 committed by Giampaolo Rodola
parent 8087831231
commit a16387ab2d
2 changed files with 6 additions and 2 deletions

View File

@ -309,7 +309,7 @@ if hasattr(os, 'listxattr'):
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:
@ -317,7 +317,8 @@ if hasattr(os, 'listxattr'):
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):

View File

@ -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.