On Fri, 13 Dec 2019 14:21:06 +0000
David Stevens <david.stev...@usu.edu> wrote:

> ** byte-compile and prepare package for lazy loading
> Fatal error: cannot open file 'C:\Users\David': No such file or
> directory
> 
> ERROR: lazy loading failed for package 'rmarkdown'

Oh. Sorry, that seems to be yet another place where R is not able to
handle temporary files with spaces in their paths.

What happens is:

1. R CMD INSTALL wants to run tools:::makeLazyLoading(...) in a
   sub-process.
2. An internal function creates a temporary file (using tempfile()),
   writes all the required commands inside it and tries to run Rterm.exe
   -f <path to the temporary file>.
3. That path is also unquoted and it also contains spaces because
   that's what GetShortPathName() returned to R.
4. C:\Users\David
   Stevens\AppData\Local\Temp\Rtmpblablabla/Rinblablablabla becomes two
   separate arguments to Rterm.exe -f.

Solution: use shQuote(Rin) in [*] instead of just Rin. I will try to
report this and the previous problem as a bug.

Workaround: try setting the TMPDIR environment variable to something
without spaces (for example, the same c:/myRLib) before launching R.
(Use Sys.getenv('TMPDIR') and tempdir() to verify that it's
working.) This should help us sidestep any remaining bugs related to
temp paths containing spaces.

-- 
Best regards,
Ivan

[*]
https://github.com/wch/r-source/blob/e554f7f12b22868bdae51aadaeea4d56c9f87a32/src/library/tools/R/check.R#L125

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to