conan: [bug] access denied while renaming unzipped folders
This issue is the same than https://github.com/conan-io/conan/issues/5205
Environment Details (include every applicable attribute)
- Operating System+version: Windows 10
- Conan version: 1.22.2
- Python version: 3.5.4
- Windows indexing is disabled for .conan folder
Steps to reproduce (Include if Applicable)
- run
conan create
orconan install
such a way it has to build from source. - use recipe and version where source code is a big package (in size or number of files), for me it happens all the time with physx and cspice (waiting merge in conan-center-index), sometimes with qt or boost, and with different computers (but always on Windows 10).
Logs (Executed commands with output) (Include/Attach if Applicable)
ERROR: physx/4.1.1: Error in source() method, line 80
os.rename(extracted_dir, self._source_subfolder)
PermissionError: [WinError 5] Access denied: 'PhysX-ae80dede0546d652040ae6260a810e53e20a06fa' -> 'source_subfolder'
Adding a try / except + sleep few seconds is a workaround, since this permission denied seems to be ephemeral, or a loop with few retries.
It would be nice if conan could provide a tools.rename in order to handle these kinds of issues on Windows.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (13 by maintainers)
In another context I’ve observed the permission denied error and there I’ve tried to isolate the problem. With the following python script I was able to produce the error nearly 100%:
=> So my conclusion so far is that maybe the file operations (before the call to
os.rename()
) return already before the file handle is released (async.).As a workaround I’ve implemented a retry loop with waiting 500 ms between retries:
I’ve checked again a conan create with physx and antivirus disabled (on my personnal computer, can’t do that on corporate desktop), I don’t have permission denied error in this case.
Sorry. I thought the PR was rejected. I will answer that and resolve the conflicts .
A couple of things:
As pointed in the other issue, maybe the AntiVirus could be related as well? Is it excluding the cache?
@uilianries Can you please try to reproduce with those recipes in Windows? The try-sleep sounds too much of a workaround, I’d prefer to know a bit better the reasons of this failure and see if something else could be done.