-
Notifications
You must be signed in to change notification settings - Fork 157
Description
Recently my organisation has been increasing IT security and various users have reported spontaneously receiving the same errors when rebuilding package caches for existing projects.
I believe the issue arises due to the following:
Line 496 in 1e065e1
file.rename(oldpath, newpath) |
It appears that the oldpath
is temporarily getting locked, and therefore failing to rename the path to newpath
. I assume it could be a virus scanner which is something you've mentioned before: #649 (comment).
I've since locally forked renv
and simply added a basic retry which appears to resolve the issue. E.g.:
if (!file.rename(oldpath, newpath)) {
for (i in 1:100) {
print("# Issuing with copying/renaming, retrying ...")
Sys.sleep(2)
test <- file.rename(oldpath, newpath)
if (test) break
}
} else {
print("# No issue copying/renaming.")
}
I'm hoping that a fix could be implemented that attempts the retry?
Apologies for the lack of a repex, it certainly seems something internal to our organisation and it's difficult to reproduce locally let alone creating a repex.
- Confirming this occurs across various versions of
renv
(certainly the latest version) - We're on Windows 11
- Warning & Error we receive:
Error in normalizePath(path.expand(path), winslash, mustWork) :
path[1]="C:/XXXX/RtmpAtrUsG/renv-package-new-5868558c675d/Matrix": The system cannot find the file specified
In addition: Warning message:
In file.rename(oldpath, newpath) :
cannot rename file 'C:/XXXX/RtmpAtrUsG/renv-package-old-586840d5629d/Matrix' to 'C:/XXXX/RtmpAtrUsG/renv-package-new-5868558c675d/Matrix', reason 'Access is denied'
Please let me know if there is any more information that would be useful to assist with solving this issue.