From mwtoews at gmail.com  Wed Sep 13 01:40:55 2017
From: mwtoews at gmail.com (Mike Toews)
Date: Wed, 13 Sep 2017 11:40:55 +1200
Subject: [Rd] unpackPkgZip: "unable to move temporary installation" due to
	antivirus
Message-ID: <CAM2FmMro4LgtkbjJjNvQ5y0ZTpVAqoDSvc4HUeNW31SvnWwbgA@mail.gmail.com>

Hi,

Me and an office colleague on Microsoft Windows 10 PCs are having
difficulty installing any package. This is a recent issue for us, and
we suspect our McAfee antivirus has modified by our IT department.
Let's take, for example, install.packages("mypackage"), here is the
output:

package ?mypackage? successfully unpacked and MD5 sums checked
Warning in install.packages :
  unable to move temporary installation
?C:\Users\mtoews\Documents\R\win-library\3.3\file382064842da2\mypackage?
to ?C:\Users\mtoews\Documents\R\win-library\3.3\mypackage?

Debugging, I found the issue around here:
https://github.com/wch/r-source/blob/980c15af89d99c04e09a40708512a57c49d1c6ee/src/library/utils/R/windows/install.packages.R#L173-L174
> ## To avoid anti-virus interference, wait a little
> Sys.sleep(0.5)

As indicated by an answer
(https://stackoverflow.com/a/44256437/327026), debugging slows down
the function to allow the package to be installed. A simple fix is to
increase the sleep time to a time that is longer than 0.5 seconds.
(I've tried testing new times, but I can't seem to overload this
function). Or use a different strategy, such as using a few attempts
with increasing wait times, or using a custom unlink function.

Happy to help out or test more on this issue. Also, if any R Core
member could add me to R's Bugzilla members, that would be convenient
for me.

Cheers,
Mike

R version 3.3.3 (2017-03-06) -- "Another Canoe"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)



[Rd] unpackPkgZip: "unable to move temporary installation" due to antivirus
Mike Toews