[Rd] Error in link in Rd file stops package installation

William Dunlap wdunlap at tibco.com
Thu Oct 22 22:53:53 CEST 2009


With a pretty recent version of R 2.11.0 (devel,unstable,
svn 50178) on Linux I could not install version 1.5-8 of zoo (the
current on on CRAN):

   % R-devel CMD INSTALL -l Rlib3 zoo
   * installing *source* package 'zoo' ...
   ** R
   ** inst
   ** preparing package for lazy loading
   ** help
   *** installing help indices
     converting help for package 'zoo'
       finding HTML links ... done
       MATCH                                   html
       ORDER                                   html
       aggregate.zoo                           html
       as.Date.ts                              html
       as.zoo                                  html
       coredata                                html
       frequency                               html
       index                                   html
       is.regular                              html
       lag.zoo                                 html
   Error: argument is of length zero
   * removing
'/a/seafiler01.na.tibco.com/vol/vol2/users/bill/packages/Rlib3/zoo'

The tryCatch calls in the installer code obliterate
most traces of where this 'argument is of length zero'
comes from.  If I run the install from a directory containing
the .Rprofile file containing the line
   utils::assignInNamespace("tryCatch", function(expr, ...) expr,
ns="base")
then I get:
   ...
       is.regular                              html
       lag.zoo                                 html  Error in if
(nzchar(file)) { :      argument is of length zero
   * removing
'/a/seafiler01.na.tibco.com/vol/vol2/users/bill/packages/Rlib3/zoo'
   * restoring previous
'/a/seafiler01.na.tibco.com/vol/vol2/users/bill/packages/Rlib3/zoo'
and I can grep around for 'if (nzchar(file))'.  (Redefining q() in
.Rprofile to give a traceback can help in the search also.)

After the attached change to Rd2HTML I get
   ...
       index                                   html
       is.regular                              html
       lag.zoo                                 html
   Rd warning: ./man/lag.zoo.Rd:54: missing file link 'diff'
       make.par.list                           html
       merge.zoo                               html
   ...
Line 54 of that help file is
     \seealso{\code{\link{zoo}}, \code{\link[stats]{lag}},
\code{\link[stats]{diff}}}
and I think the [stats]{diff} should be [base]{diff}.

The change I made (which isn't quite right but avoids
mysteriously killing the installation for what turns out
to be a minor error) was

Index: src/library/tools/R/Rd2HTML.R
===================================================================
--- src/library/tools/R/Rd2HTML.R       (revision 50178)
+++ src/library/tools/R/Rd2HTML.R       (working copy)
@@ -305,7 +305,7 @@
                 if (!OK) {
                     ## so how about as a topic?
                     file <- utils:::index.search(parts$targetfile,
pkgpath)
-                    if (nzchar(file)) {
+                    if (length(file)>0 && nzchar(file)) {
                         warnRd(block, Rdfile,
                                "file link ", sQuote(parts$targetfile),
                                " in package ", sQuote(parts$pkg),

A longer range fix would be to print more contextual
information with the error messages from INSTALL.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com 



More information about the R-devel mailing list