Error with cp permissions R CMD Build

Continuing the discussion from R 4.2.0: File rstudio.lock creates "copying to build directory failed (Permission denied)" error:

I'm having this same problem. Running via docker RV4.5.2

I tried re-cloning the project and no fix


── R CMD build ────────────────────────────────────────────────────────────────────────
βœ”  checking for file β€˜/home/rstudio/STATISTICS/NON STUDY FOLDER/Academic Research/Eudract Tool/R/eudract_pkg/DESCRIPTION’ ...
   cp: error reading 'eudract_pkg/.Rproj.user/0A43DB4F/sources/session-2d2a3736/lock_file': Permission denied
    ERROR
   copying to build directory failed

This is clearly related to RStudio, so try adding the 'rstudio' tag to your post, to make sure that the right people will see it.

I re-ran the devtools::check() command on a different machine, still using R/Rstudio via docker, but the file location was on a local drive, rather than a windows network drive mounted on the container. Working fine. So this is a tentative explanation for the cause, but not really a solution as I'd still expect to be able to build packages from a folder on a network drive