From: Ying Wang Date: Thu, 30 May 2019 03:25:31 +0000 (-0400) Subject: bpo-24564: shutil.copystat(): ignore EINVAL on os.setxattr() (GH-13369) X-Git-Tag: v3.8.0b1~129 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a16387ab2d85f19665920bb6ff91a7e57f59dd2a;p=python bpo-24564: shutil.copystat(): ignore EINVAL on os.setxattr() (GH-13369) --- diff --git a/Lib/shutil.py b/Lib/shutil.py index b2e8f5fd75..2dfae87c9c 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -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): diff --git a/Misc/NEWS.d/next/Library/2019-05-16-23-40-36.bpo-24564.lIwV_7.rst b/Misc/NEWS.d/next/Library/2019-05-16-23-40-36.bpo-24564.lIwV_7.rst new file mode 100644 index 0000000000..27cb6178b5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2019-05-16-23-40-36.bpo-24564.lIwV_7.rst @@ -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.