HenrikBengtsson / startup

:wrench: R package: startup - Friendly R Startup Configuration
https://henrikbengtsson.github.io/startup/
163 stars 5 forks source link

R started with error if .Rprofile is a symbol link on Windows #58

Closed hongyuanjia closed 6 years ago

hongyuanjia commented 6 years ago

First, thanks for this amazing package.

I use a git repo to sync all my dot files, including Rconsole and .Rprofile. So the .Rprofile file in R_USER is actually a symbol link to that file in the git repo.

After adding try(startup::startup) into the .Rprofile file, R complained about: Error in if (!eof_ok(file)) { : argument is of length zero. After digging a little bit, this was caused by the eof_ok() function in check.R . file.info could not resolve symbol link on Windows (I did not know if it could on a Mac or Linux), so file.info(file)$size will always return 0 and readBin will read nothing, as n was set to 0.

Any way to get around this?

HenrikBengtsson commented 6 years ago

Thanks, I'm glad hear.

As a quick workaround, you can disable the checks by using startup(check = FALSE).

Now, for me to me to fix this, are you saying you're on Windows and your ~/.Rprofile (or R_USER) file is a symbolic link and when you start R it recognizes the symbolic link and follows it? Are you on an NTFS file system? How did you create the symbolic link on Windows? If I get these details, I could reproduce the error and create a proper fix.

hongyuanjia commented 6 years ago

Thanks! After setting check to FALSE, the error was gone.

Now, for me to me to fix this, are you saying you're on Windows and your ~/.Rprofile (or R_USER) file is a symbolic link and when you start R it recognizes the symbolic link and follows it?

Yes. I am on Windows, and R can successfully recognize the symbolic link and follow it to the real file.

Are you on an NTFS file system?

Yes. I am using Windows 10 installed on a NTFS format disk.

How did you create the symbolic link on Windows?

The symbolic link was created using base::file.syslink with Administrator rights.

Hope info above can help.

HenrikBengtsson commented 6 years ago

Fixed in develop branch.