From charles.dupont at vanderbilt.edu  Tue Sep 26 21:49:29 2006
From: charles.dupont at vanderbilt.edu (charles.dupont at vanderbilt.edu)
Date: Tue, 26 Sep 2006 21:49:29 +0200 (CEST)
Subject: [Rd] Infinite Loop when installing a package from source (PR#9258)
Message-ID: <20060926194929.AFF76281E5@slim.kubism.ku.dk>

Full_Name: Charles Dupont
Version: Version 2.3.1
OS: linux
Submission from: (NULL) (160.129.129.136)


I think that this is infinite.  I let it run for 30 minutes.  During which it
consumed 98% of my memory (1Gb) and steadily helled 90-99% of CPU.

Steps to reproduce problem

1. get a source package e.g. Hmisc.

2.
$ echo "library(Hmisc)" > Hmisc/R/test.R

3.
$ R CMD INSTALL -d -l Hmisc.Rcheck -d Hmisc

Here is the output of the call
'Rcmd INSTALL': in startdir= /home/dupontct/R with tmpdir=
/tmp/R.INSTALL.IO1457
   lib= '/home/dupontct/Hmisc.Rcheck', pkgs= ' "/home/dupontct/R/Hmisc"'
   before checking lockdir= '/home/dupontct/Hmisc.Rcheck/00LOCK'
   after checking lockdir
   build_help_opts= '--debug  --txt --html --latex --example'
'Rcmd INSTALL': now doing 'eval ... do_install':
* Installing *source* package 'Hmisc' ...
** libs
++ mkdir -p /home/dupontct/Hmisc.Rcheck/Hmisc/libs
++ test -f src/Makefile
++ cd src
+++ ls cidxcn.f cidxcp.f hoeffd.f jacklins.f largrec.f ranksort.c rcorr.f
string_box.c wclosest.f '*.cc' '*.cpp' '*.f90' '*.f95'
++ srcs='cidxcn.f
cidxcp.f
hoeffd.f
jacklins.f
largrec.f
ranksort.c
rcorr.f
string_box.c
wclosest.f'
+++ cd /usr/lib/R/bin/exec
+++ ls
++ archs=R
++ R_ARCH_keep=
++ test -n 'cidxcn.f
cidxcp.f
hoeffd.f
jacklins.f
largrec.f
ranksort.c
rcorr.f
string_box.c
wclosest.f'
++ test -x ../configure
++ for arch in '${archs}'
++ rm -f cidxcn.o cidxcp.o hoeffd.o jacklins.o largrec.o ranksort.o rcorr.o
string_box.o wclosest.o Hmisc.so '*.sl' '*.dylib'
++ test R = R
++ R_ARCH=
++ export R_ARCH
++ sh /usr/lib/R/bin/SHLIB -o Hmisc.so cidxcn.f cidxcp.f hoeffd.f jacklins.f
largrec.f ranksort.c rcorr.f string_box.c wclosest.f
gfortran   -fpic  -g -O2 -c cidxcn.f -o cidxcn.o
gfortran   -fpic  -g -O2 -c cidxcp.f -o cidxcp.o
gfortran   -fpic  -g -O2 -c hoeffd.f -o hoeffd.o
gfortran   -fpic  -g -O2 -c jacklins.f -o jacklins.o
gfortran   -fpic  -g -O2 -c largrec.f -o largrec.o
gcc -I/usr/share/R/include -I/usr/share/R/include     -fpic  -g -O2 -std=gnu99
-c ranksort.c -o ranksort.o
gfortran   -fpic  -g -O2 -c rcorr.f -o rcorr.o
gcc -I/usr/share/R/include -I/usr/share/R/include     -fpic  -g -O2 -std=gnu99
-c string_box.c -o string_box.o
gfortran   -fpic  -g -O2 -c wclosest.f -o wclosest.o
gcc -shared  -o Hmisc.so cidxcn.o cidxcp.o hoeffd.o jacklins.o largrec.o
ranksort.o rcorr.o string_box.o wclosest.o  -lgfortran -lm -lgcc_s
-L/usr/lib/R/lib -lR
++ cp Hmisc.so /home/dupontct/Hmisc.Rcheck/Hmisc/libs
++ R_ARCH=
++ cd ..
++ false
++ chmod 755 /home/dupontct/Hmisc.Rcheck/Hmisc/libs/Hmisc.so
++ true
++ set +x
** R
** inst
** preparing package for lazy loading
Loading required package: chron

Controll C administered here.  After Ctrl-C additional output followed.

Warning message:
use of NULL environment is deprecated
Error: unable to load R code in package 'Hmisc'
Error: unable to load R code in package 'Hmisc'
Error: unable to load R code in package 'Hmisc'
Error: unable to load R code in package 'Hmisc'
Error: unable to load R code in package 'Hmisc'
Error: unable to load R code in package 'Hmisc'
Error: unable to load R code in package 'Hmisc'
Error: unable to load R code in package 'Hmisc'
Error: unable to load R code in package 'Hmisc'
Error: unable to load R code in package 'Hmisc'
Error: unable to load R code in package 'Hmisc'
Execution halted
** Removing '/home/dupontct/Hmisc.Rcheck/Hmisc'

On further exploration I found that the problem resides in the 
tools:::code2LazyLoadDB function.  The call to sys.source falls into an infinite
loop when it tries to evaluate the line "library(Hmisc)" from the test.R file.




[Rd] Infinite Loop when installing a package from source (PR#9258)
charles.dupont at vanderbilt.edu