Ben Spiller <spiller....@gmail.com> added the comment:

Looks like on WSL the errno is errno.EACCES rather than EPERM, so we just need 
to change the shutil._copyxattr error handler to also cope with that error code:

             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.EACCES):
                     raise

If anyone needs a workaround until this is fixed in shutil itself, you can do 
it by monkey-patching _copyxattr:

import errno, shutil
# have to monkey patch to work with WSL as workaround for 
https://bugs.python.org/issue38633
orig_copyxattr = shutil._copyxattr
def patched_copyxattr(src, dst, *, follow_symlinks=True):
        try:
                orig_copyxattr(src, dst, follow_symlinks=follow_symlinks)
        except OSError as ex:
                if ex.errno != errno.EACCES: raise
shutil._copyxattr = patched_copyxattr

----------
nosy: +benspiller

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue38633>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to