[issue38633] shutil.copystat fails with PermissionError in WSL

Peter report at bugs.python.org
Tue Oct 29 10:34:38 EDT 2019


New submission from Peter <peter.schmidb at gmail.com>:

Using shutil.copystat (and therefore also shutil.copytree) in WSL on any directories from a mounted Windows drive (i.e. /mnt/c/...) raises an shutil.Error "[Errno 13] Permission denied". 

It seems to fail when copying the extended filesystem attribute "system.wsl_case_sensitive" using os.setxattr() here: 
https://github.com/python/cpython/blob/da6ce58dd5ac109485af45878fca6bfd265b43e9/Lib/shutil.py#L322

Note that this only happens when both src and dst are on the mounted drive. If only one is on the drive and the other is e.g. in the home directory /home/username/, it will not raise an error. 

Quick way to test: 

cd /mnt/c/ && mkdir test1 && mkdir test2 && python -c "import shutil; shutil.copystat('test1', 'test2')"

----------
components: Library (Lib), Windows
messages: 355655
nosy: paul.moore, pspeter, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: shutil.copystat fails with PermissionError in WSL
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38633>
_______________________________________


More information about the Python-bugs-list mailing list