]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-82814: fix shutil access error on WSL (#103790)
authorAllan Lago <35788148+alago1@users.noreply.github.com>
Tue, 25 Apr 2023 00:45:38 +0000 (18:45 -0600)
committerGitHub <noreply@github.com>
Tue, 25 Apr 2023 00:45:38 +0000 (00:45 +0000)
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>

Lib/shutil.py
Misc/NEWS.d/next/Windows/2023-04-24-15-51-11.gh-issue-82814.GI3UkZ.rst [new file with mode: 0644]

index c75ea4da02ebb44f888b60fcd7f826d22416f548..7d1a3d00011f3773e4b3f75f268ae0fbcb3d4166 100644 (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):
diff --git a/Misc/NEWS.d/next/Windows/2023-04-24-15-51-11.gh-issue-82814.GI3UkZ.rst b/Misc/NEWS.d/next/Windows/2023-04-24-15-51-11.gh-issue-82814.GI3UkZ.rst
new file mode 100644 (file)
index 0000000..5bd005f
--- /dev/null
@@ -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.