Shared folder fails for python shutil.rmtree

Discussions related to using VirtualBox on Windows hosts.
Post Reply
PeterFromSwe
Posts: 5
Joined: 29. Jan 2018, 20:45
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Ubuntu

Shared folder fails for python shutil.rmtree

Post by PeterFromSwe »

VirtualBox 6.0.12 r133076
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
Save below into %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")'
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Shared folder fails for python shutil.rmtree

Post by scottgus1 »

PeterFromSwe wrote:vagrant up
Sorry, Vagrant uses Virtualbox in ways we can't predict, so we don't support Vagrant-modified Virtualbox. You'll have to ask them.
PeterFromSwe
Posts: 5
Joined: 29. Jan 2018, 20:45
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Ubuntu

Re: Shared folder fails for python shutil.rmtree

Post by PeterFromSwe »

Sorry, post was not actually about vagrant, it was just a means of easy setup of traceable vm.
I am told that this is a duplicate of https://www.virtualbox.org/ticket/19004 ... num_hist=2 so problem is there.
Post Reply