From p.dalgaard at biostat.ku.dk  Sat Oct 15 17:41:14 2005
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: 15 Oct 2005 17:41:14 +0200
Subject: [Rd] Hiccup in installing R 2.2.0
In-Reply-To: <200510151452.j9FEqdRa010229@erdos.math.unb.ca>
References: <200510151452.j9FEqdRa010229@erdos.math.unb.ca>
Message-ID: <x2vezykcth.fsf@turmalin.kubism.ku.dk>

Rolf Turner <rolf at math.unb.ca> writes:

> Yesterday I downloaded R-2.2.0.tar.gz, gunzipped and untarred, and
> did the usual ./configure and make.  Everything seemed to go smoothly
> until it got to the bit about installing recommended packages.  It
> got past ``spatial'' but turned up a fatal error in respect of the
> ``boot'' package.
> 
> Here is some of what appeared on the screen:
> 
> ===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===
>      .
>      .
>      .
>   trls.influence                    text    html    latex   example
>   trmat                             text    html    latex   example
>   variogram                         text    html    latex   example
> ** building package indices ...
> * DONE (spatial)
> begin installing recommended package boot
> * Installing *source* package 'boot' ...
> mkdir: cannot create directory `/tmp/Rtmp9726': File exists
> ERROR: cannot create temporary R session directory
> ERROR: installing package DESCRIPTION failed
> /home/faculty/rolf/Rinst/R-2.2.0/bin/INSTALL: test: argument expected
> *** Error code 1
> make: Fatal error: Command failed for target `boot.ts'
> Current working directory /homes/faculty/rolf/Rinst/R-2.2.0/src/library/Recommended
> *** Error code 1
> make: Fatal error: Command failed for target `recommended-packages'
> Current working directory /homes/faculty/rolf/Rinst/R-2.2.0/src/library/Recommended
> *** Error code 1
> make: Fatal error: Command failed for target `stamp-recommended'
> ===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===+===
> 
> The system I am working on is a ``sparc'' (from Sun) running
> Solaris 2.9.
> 
> I checked on /tmp, and there was indeed a directory (empty) named
> Rtmp9726, owned by another user on our system.  (It was dated October
> 7, 2005, i.e. about a week ago.)  Fortunately (???) I have superuser
> priviledges, so I was able to remove this (empty) directory.  I then
> tried ``make'' again, and this time it ran to completion.  So I'm
> alright, Jack.  It would seem however that something is not
> ***quite*** as it should be in the installation procedure.  I thought
> I'd just draw this to youse guys' attention. :-)

This looks like it would be a generic issue, not particularly related
to installation. The code in question should be this:

#ifdef HAVE_MKDTEMP
        sprintf(tmp1, "%s/RtmpXXXXXX", tm);
        tmp = mkdtemp(tmp1);
        if(!tmp) R_Suicide(_("cannot mkdir R_TempDir"));
#else
        sprintf(tmp1, "rm -rf %s/Rtmp%u", tm, (unsigned int)getpid());
        R_system(tmp1);
        sprintf(tmp1, "%s/Rtmp%u", tm, (unsigned int)getpid());
        res = mkdir(tmp1, 0755);
        if(res) {
            /* Try one more time, in case a dir left around from that
               process number from another user */
            sprintf(tmp1, "rm -rf %s/Rtmp%u-%d", tm, (unsigned int)getpid(),
                    rand() % 1000);
            R_system(tmp1);
....

inside src/unix/sys-unix.c. I don't think Solaris has mkdtemp (ours
don't anyway), and the name of the conflicting dir indicates that the
code never went inside the if(res){...} so the conclusion would seem
to be that mkdir fails to fail when it should.

(Notice, BTW, that the name of the dir is keyed to the process ID of
R, so removing the exising directory doesn't really help you. The
thing that might help would be to remove all the Rtmp* directories at
boot and periodically before PID wraparound.)

-- 
   O__  ---- Peter Dalgaard             ?ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



[Rd] Hiccup in installing R 2.2.0
Peter Dalgaard