From wdunlap at tibco.com  Mon Dec 15 22:14:05 2008
From: wdunlap at tibco.com (William Dunlap)
Date: Mon, 15 Dec 2008 13:14:05 -0800
Subject: [Rd] bug in R CMD INSTALL do_install under OS X
In-Reply-To: <77EB52C6DD32BA4D87471DCD70C8D70053609B@NA-PA-VBE03.na.tibco.com>
References: <376b783d0812150204h551df587t51ab032a4f980a72@mail.gmail.com>
	<77EB52C6DD32BA4D87471DCD70C8D70053609B@NA-PA-VBE03.na.tibco.com>
Message-ID: <77EB52C6DD32BA4D87471DCD70C8D7005360B9@NA-PA-VBE03.na.tibco.com>


Note that this is identical to Problem #8363, marked as 'not-
reproducible'.
   Date: Fri, 02 Dec 2005 17:41:32 +0100
   From: Philip Lijnzaad <p.lijnzaad at med.uu.nl>
   Subject: R CMD INSTALL fails if cd prints stuff to stdout ...
   To: r-bugs at r-project.org

A possible patch would be
   Index: src/scripts/INSTALL.in
   ===================================================================
   --- src/scripts/INSTALL.in      (revision 47210)
   +++ src/scripts/INSTALL.in      (working copy)
   @@ -78,6 +78,7 @@
    warning () { echo "WARNING: $*" >&2 ; }
    error ()   { echo "ERROR: $*" >&2 ; }
   
   +unset CDPATH  
    startdir=`${GETWD}`
    : ${TMPDIR=/tmp}
    { tmpdir=`(mktemp -d -q "${TMPDIR}/R.INSTALL.XXXXXX") 2>/dev/null` \

although one might prefer to put that line into CMD so no script could
have CDPATH set.  I cannot imagine why a script would want to cd
to work in this nonstandard way.

> -----Original Message-----
> From: r-devel-bounces at r-project.org 
> [mailto:r-devel-bounces at r-project.org] On Behalf Of William Dunlap
> Sent: Monday, December 15, 2008 12:30 PM
> To: David Rossell; r-devel at r-project.org
> Subject: Re: [Rd] bug in R CMD INSTALL do_install under OS X
> 
> This problem could be caused by having CDPATH set.  E.g.,
> 
>    % env CDPATH=. ~/R-svn/r-devel/R/bin/R CMD INSTALL -l Rlib
> testCMacros
>    /homes/bill/packages/Rlib
>    /homes/bill/R-svn/r-devel/R/bin/INSTALL: line 948: cd:
> /homes/bill/packages/testCMacros
>    
> /a/seafiler01.na.tibco.com/vol/vol2/users/bill/packages/testCMacros:
> No such file or directory
>    /bin/sed: can't read DESCRIPTION: No such file or directory
>    ERROR: no 'Package' field in 'DESCRIPTION'
>    /bin/sed: read error on /homes/bill/packages/testCMacros: Is a
> directory
> (It works fine if I set 'CDPATH='.)
> 
> The happens because, from 'man cd' in
> http://www.linuxhowtos.org/manpages/1p/cd.htm:
> 
>    If a non-empty directory name from CDPATH is used, or if
>    cd - is used, an absolute pathname of the new working
>    directory shall be written to the standard output as follows:
>     "%s\n", <new directory>
>    Otherwise, there shall be no output.
> 
> and INSTALL uses the idiom
>     `cd ${dir} && /bin/pwd`
> to convert the directory name dir to a full path.   
> 
> libtools explicitly unsets CDPATH, presumably to avoid this
> sort of problem.  All the R scripts should do so.
> 
> Bill Dunlap
> TIBCO Software Inc - Spotfire Division
> wdunlap tibco.com  
> 
> > -----Original Message-----
> > From: r-devel-bounces at r-project.org 
> > [mailto:r-devel-bounces at r-project.org] On Behalf Of David Rossell
> > Sent: Monday, December 15, 2008 2:05 AM
> > To: r-devel at r-project.org
> > Subject: [Rd] bug in R CMD INSTALL do_install under OS X
> > 
> > Hi, I believe I've encountered a bug in the do_install 
> function in the
> > script used by R CMD INSTALL. I'm using R 2.8.0 under OS X 
> > 10.5.5. I was
> > trying to install a package from source (the package gaga 
> > which I maintain,
> > which I checked and builds correctly for R 2.8.0) when I 
> get the error
> > message
> > 
> > * Installing to library '/Users/drossell/Desktop/R-2.8.0/library'
> > /Users/drossell/Desktop/R-2.8.0/bin/INSTALL: line 950: cd:
> > /Volumes/biostats/projects/routines/R/gaga
> > /Volumes/biostats/projects/routines/R/gaga: No such file or 
> directory
> > sed: DESCRIPTION: No such file or directory
> > ERROR: no 'Package' field in 'DESCRIPTION'
> > 
> > I get this same error for any other package that I try to install.
> > 
> > Upon debugging the script, I've found that the script is 
> > trying to cd to
> > "/Volumes/biostats/projects/routines/R/gaga\n/Volumes/biostats
> /projects/routines/R/gaga".
> > That is, the directory is repeated twice, which causes the 
> > installation to
> > fail. To temporarily fix the bug I commented out the 1st two 
> > lines in the
> > do_install function and manually specified the directory. 
> > After doing this
> > the package installs just fine.
> > 
> > #  cd "${1}"
> > #  pkg_dir="${1}"
> >   cd "/Volumes/biostats/projects/routines/R/gaga"   #line added
> >   pkg_dir="/Volumes/biostats/projects/routines/R/gaga" #line added
> > 
> > Thanks,
> > 
> > David
> > 
> > 	[[alternative HTML version deleted]]
> > 
> > ______________________________________________
> > R-devel at r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-devel
> > 
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 



[Rd] bug in R CMD INSTALL do_install under OS X
William Dunlap