Host: Windows 7 64-bit
Guest: Ubuntu 18.04 (Python 3.6.9)
Problem
python3 -c 'import shutil; shutil.rmtree("1a")'
Error message
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python3.6/shutil.py", line 486, in rmtree
_rmtree_safe_fd(fd, path, onerror)
File "/usr/lib/python3.6/shutil.py", line 424, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/lib/python3.6/shutil.py", line 424, in _rmtree_safe_fd
_rmtree_safe_fd(dirfd, fullname, onerror)
File "/usr/lib/python3.6/shutil.py", line 428, in _rmtree_safe_fd
onerror(os.rmdir, fullname, sys.exc_info())
File "/usr/lib/python3.6/shutil.py", line 426, in _rmtree_safe_fd
os.rmdir(name, dir_fd=topfd)
OSError: [Errno 26] Text file busy: '4a'
Expected behaviour
Just as rm -r 1a
Reproduction steps
Code: Select all
cd %TEMP%
mkdir PythonAndSharedFolder
cd PythonAndSharedFolder
mkdir synched_folder\1a\2a\3a\4a
mkdir synched_folder\1a\2b\3a\4a
mkdir synched_folder\1b\2a\3a\4a
notepad %TEMP%\PythonAndSharedFolder\Vagrantfile
Code: Select all
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/bionic64"
config.vm.provider "virtualbox" do |vb|
vb.name = "Python rmtree issue"
end
config.vm.synced_folder "synched_folder", "/home/vagrant/synched_folder"
end
Code: Select all
vagrant box add ubuntu/bionic64 --box-version v20200112.0.0
vagrant up
vagrant ssh
Code: Select all
cd synched_folder
python3 -c 'import shutil; shutil.rmtree("1a")'