mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
bpo-24564: shutil.copystat(): ignore EINVAL on os.setxattr() (GH-13369)
This commit is contained in:
parent
8087831231
commit
a16387ab2d
2 changed files with 6 additions and 2 deletions
|
|
@ -309,7 +309,7 @@ if hasattr(os, 'listxattr'):
|
||||||
try:
|
try:
|
||||||
names = os.listxattr(src, follow_symlinks=follow_symlinks)
|
names = os.listxattr(src, follow_symlinks=follow_symlinks)
|
||||||
except OSError as e:
|
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
|
raise
|
||||||
return
|
return
|
||||||
for name in names:
|
for name in names:
|
||||||
|
|
@ -317,7 +317,8 @@ if hasattr(os, 'listxattr'):
|
||||||
value = os.getxattr(src, name, follow_symlinks=follow_symlinks)
|
value = os.getxattr(src, name, follow_symlinks=follow_symlinks)
|
||||||
os.setxattr(dst, name, value, follow_symlinks=follow_symlinks)
|
os.setxattr(dst, name, value, follow_symlinks=follow_symlinks)
|
||||||
except OSError as e:
|
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
|
raise
|
||||||
else:
|
else:
|
||||||
def _copyxattr(*args, **kwargs):
|
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.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue