[Rd] installed.packages Error: subscript out of bounds
Hervé Pagès
hpages at fhcrc.org
Wed Nov 10 22:13:17 CET 2010
Hi,
Today we've seen the following problem with the R-2.12 that we use
for our Windows builds:
> installed.packages()
Error: subscript out of bounds
After some investigation we discovered that the cause of this failure
was that 1 of the 890 packages currently installed on the machine
(Windows Server 2003 R2) had its DESCRIPTION file empty:
E:\biocbld\bbs-2.7-bioc\R\library>ls -al DLBCL
total 1
drwxr-xr-x+ 1 biocbuild2 root 0 2010-11-08 14:11 .
drwxr-xr-x+ 1 biocbuild2 root 0 2010-11-10 00:14 ..
-rwxr-xr-x+ 1 biocbuild2 root 0 2010-11-08 14:11 DESCRIPTION
-rwxr-xr-x+ 1 biocbuild2 root 357 2010-11-08 14:11 INDEX
drwxr-xr-x+ 1 biocbuild2 root 0 2010-11-08 14:11 data
drwxr-xr-x+ 1 biocbuild2 root 0 2010-11-08 14:11 help
drwxr-xr-x+ 1 biocbuild2 root 0 2010-11-08 14:11 html
Then from R:
> library(DLBCL)
Error in library(DLBCL) : there is no package called 'DLBCL'
> packageDescription("DLBCL")
Error in packageDescription("DLBCL") :
DESCRIPTION file of package 'DLBCL' is corrupt
> installed.packages()
Error: subscript out of bounds
I have no idea how this DESCRIPTION file ended up empty. I've never
seen this before. Probably a very rare race condition that would be
very hard to reproduce.
Anyway would it be possible to have installed.packages() give
a more informative error message when this happens? That would
make it behave more consistently with packageDescription().
Does something like this sound reasonable?
hpages at latitude:~/svn/R-trunk$ svn diff src/library/utils/R/packages.R
Index: src/library/utils/R/packages.R
===================================================================
--- src/library/utils/R/packages.R (revision 53546)
+++ src/library/utils/R/packages.R (working copy)
@@ -453,6 +453,11 @@
domain = NA, call. = FALSE)
next
}
+ if (NROW(desc) < 1L) {
+ warning(gettextf("file '%s' is corrupt", pkgpath),
+ domain = NA, call. = FALSE)
+ next
+ }
desc <- desc[1,]
Rver <- strsplit(strsplit(desc["Built"], ";")[[1L]][1L],
"[ \t]+")[[1L]][2L]
Thanks,
H.
--
Hervé Pagès
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
P.O. Box 19024
Seattle, WA 98109-1024
E-mail: hpages at fhcrc.org
Phone: (206) 667-5791
Fax: (206) 667-1319
More information about the R-devel
mailing list