{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/9526","labels_url":"https://api.github.com/repos/ansible/ansible/issues/9526/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/9526/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/9526/events","html_url":"https://github.com/ansible/ansible/issues/9526","id":48225420,"number":9526,"title":"file operations fail on shared/synced folders that do not implement correct filesystem semantics","user":{"login":"dopry","id":387640,"avatar_url":"https://avatars.githubusercontent.com/u/387640?v=3","gravatar_id":"","url":"https://api.github.com/users/dopry","html_url":"https://github.com/dopry","followers_url":"https://api.github.com/users/dopry/followers","following_url":"https://api.github.com/users/dopry/following{/other_user}","gists_url":"https://api.github.com/users/dopry/gists{/gist_id}","starred_url":"https://api.github.com/users/dopry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dopry/subscriptions","organizations_url":"https://api.github.com/users/dopry/orgs","repos_url":"https://api.github.com/users/dopry/repos","events_url":"https://api.github.com/users/dopry/events{/privacy}","received_events_url":"https://api.github.com/users/dopry/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ansible/ansible/labels/bug_report","name":"bug_report","color":"fbca04"},{"url":"https://api.github.com/repos/ansible/ansible/labels/P3","name":"P3","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":25,"created_at":"2014-11-10T02:57:14Z","updated_at":"2015-03-27T12:47:32Z","closed_at":null,"body":"##### Issue Type:\r\n\r\n“Bug Report”, \r\n\r\n##### Ansible Version:\r\n\r\n1.7.2\r\n\r\n##### Environment:\r\n\r\nUbuntu 14.04.1 VM on Virtual Box 4.3.14  on Windows 8.1 \r\nI know the issue is likely specific to vboxfs \r\n\r\n##### Summary:\r\n\r\nThe copy modules fails on virtual box shared folders. specifically the os.rename() fails.  I tried replacing the os.rename with shutils.copy2 and it worked fine.  \r\n\r\nI notice there is a lot of working being done in atomic_move. There is a fallback strategy that seems to attempt to copy the source file to a temp file in the destination directory, and then rename the temp file. Why not just do the copy straight to the destination and let cleanup() handle the stuff in the temp folder?\r\n\r\nI tested a few scenarios if I try to copy to some place besides the shared folder, the module works. So the source doesn't appear to be what is blocking the rename, but it's the destination. I tried hard coding an alternate destination at the os.rename, in case a previous operation was taking a lock, but still kept receiving error 26.\r\n\r\nWhen I try opening up the repl, I get a slightly different error, but an error none the same..\r\n\r\n>>> import os\r\n>>> os.rename('test.txt', '/vagrant/test.txt')\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\nOSError: [Errno 18] Invalid cross-device link\r\n\r\n\r\nIt looks like os.rename doesn't work across partitions, and this is the root of the problem. (maybe this is why it tries to copy to the save folder as the destination, then renames).\r\n\r\nhttps://mail.python.org/pipermail/python-list/2005-February/342893.html\r\nhttps://bugs.launchpad.net/python-keystoneclient/+bug/1265190\r\n\r\n##### Steps To Reproduce:\r\n\r\ninstall virtualbox. \r\n\r\nput all the files from  https://gist.github.com/dopry/4bc4f2d852b8055a7b68 in a folder.\r\n\r\nvagrant up \r\nvagrant ssh \r\n\r\nfrom inside the vm..\r\n\r\necho \"test\" > test.txt\r\nansible web -i /vagrant/ansible/inventory/vagrant/hosts.py -m copy -a \"src=test.txt dest=/vagrant/test.txt\"\r\n\r\n##### Expected Results:\r\ntest.txt is copied to  /vagrant.\r\n\r\n##### Actual Results:\r\n\r\nvagrant.dev | FAILED >> {\r\n    \"failed\": true,\r\n    \"md5sum\": \"bbfa1f311a5828452b953d1335cbf027\",\r\n    \"msg\": \"could not cleanup /vagrant/.ansible_tmpE8ytJhtest.txt: [Errno 26] Text file busy: '/vagrant/.ansible_tmpE8ytJhtest.txt'{\\\"msg\\\": \\\"Could not replace file: /home/vagrant/.ansible/tmp/ansible-tmp-1415586483.17-87111780037684/source to /vagrant/test.txt: [Errno 26] Text file busy\\\", \\\"failed\\\": true}\\r\\n\",\r\n    \"parsed\": false\r\n}\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/86930682","html_url":"https://github.com/ansible/ansible/issues/9526#issuecomment-86930682","issue_url":"https://api.github.com/repos/ansible/ansible/issues/9526","id":86930682,"user":{"login":"bcoca","id":836171,"avatar_url":"https://avatars.githubusercontent.com/u/836171?v=3","gravatar_id":"","url":"https://api.github.com/users/bcoca","html_url":"https://github.com/bcoca","followers_url":"https://api.github.com/users/bcoca/followers","following_url":"https://api.github.com/users/bcoca/following{/other_user}","gists_url":"https://api.github.com/users/bcoca/gists{/gist_id}","starred_url":"https://api.github.com/users/bcoca/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcoca/subscriptions","organizations_url":"https://api.github.com/users/bcoca/orgs","repos_url":"https://api.github.com/users/bcoca/repos","events_url":"https://api.github.com/users/bcoca/events{/privacy}","received_events_url":"https://api.github.com/users/bcoca/received_events","type":"User","site_admin":false},"created_at":"2015-03-27T12:47:32Z","updated_at":"2015-03-27T12:47:32Z","body":"we are adding windows as a target, there are no plans to support windows as a controller/master"}}