[R] Unix R core dumps if $HOME is not set.

Michael Meyer michael.m.meyer at boeing.com
Tue Oct 27 19:36:33 CET 1998

One of my colleagues was/is trying to run R via a WWW perl script.  The way 
our system is configured (and I have no control over this), he ends up 
in a process where the HOME environment variable is not set.  When he 
tries to run R all he gets is a core dump.

A regular user can verify this by just unsetting the HOME variable and 
trying to run R.

The problem is in the  system.c  file, in the following lines, 
  if (LoadInitFile) {
    if ((fp = R_fopen(".Rprofile", "r")))
      return fp;
    sprintf(buf, "%s/.Rprofile", getenv("HOME"));
    if ((fp = R_fopen(buf, "r")))
      return fp;

I won't suggest a fix (because everyone has their favorite ways of 
dancing around error returns from system calls), but I think there 
needs to be a small test for a null return from getenv.

(Once I discovered this we "solved" the problem by setting the HOME 
variable in the perl script which calls R).

Regards, --Mike

Mike Meyer, Applied Statistics, The Boeing Company

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list