gh-82814: fix shutil access error on WSL (#103790)

gh-82814: Adds `errno.EACCES` to the list of ignored errors on
`_copyxattr`.  EPERM and EACCES are different constants but
in general should be treated the same.

News entry authored by: Gregory P. Smith <greg@krypto.org>
This commit is contained in:
Allan Lago 2023-04-24 18:45:38 -06:00 committed by GitHub
parent b51da991e2
commit 3df3b91e6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -332,7 +332,7 @@ if hasattr(os, 'listxattr'):
os.setxattr(dst, name, value, follow_symlinks=follow_symlinks)
except OSError as e:
if e.errno not in (errno.EPERM, errno.ENOTSUP, errno.ENODATA,
errno.EINVAL):
errno.EINVAL, errno.EACCES):
raise
else:
def _copyxattr(*args, **kwargs):

View File

@ -0,0 +1,3 @@
Fix a potential ``[Errno 13] Permission denied`` when using :func:`shutil.copystat`
within Windows Subsystem for Linux (WSL) on a mounted filesystem by adding
``errno.EACCES`` to the list of ignored errors within the internal implementation.