From murdoch at stats.uwo.ca  Fri Oct 23 14:23:13 2009
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Fri, 23 Oct 2009 08:23:13 -0400
Subject: [Rd] Error in link in Rd file stops package installation
In-Reply-To: <77EB52C6DD32BA4D87471DCD70C8D70001FE3E74@NA-PA-VBE03.na.tibco.com>
References: <77EB52C6DD32BA4D87471DCD70C8D70001FE3D90@NA-PA-VBE03.na.tibco.com>
	<77EB52C6DD32BA4D87471DCD70C8D70001FE3E74@NA-PA-VBE03.na.tibco.com>
Message-ID: <4AE1A031.9020808@stats.uwo.ca>

On 10/22/2009 11:03 PM, William Dunlap wrote:
> The following patch seems to get the warning message right

Thanks, I'll put this in if nobody else gets there first.

Duncan Murdoch


>     lag.zoo                                 html
> Rd warning: ./man/lag.zoo.Rd:54: file link 'diff' in package 'stats'
> does not exist and so has been treated as a topic
> 
> 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),
> 
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com  
> 
>> -----Original Message-----
>> From: r-devel-bounces at r-project.org 
>> [mailto:r-devel-bounces at r-project.org] On Behalf Of William Dunlap
>> Sent: Thursday, October 22, 2009 1:54 PM
>> To: R-devel at r-project.org
>> Subject: [Rd] Error in link in Rd file stops package installation
>> 
>> 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 
>> 
>> ______________________________________________
>> 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] Error in link in Rd file stops package installation
Duncan Murdoch