From m.pacey at lancaster.ac.uk  Mon Aug 13 16:28:31 2007
From: m.pacey at lancaster.ac.uk (m.pacey at lancaster.ac.uk)
Date: Mon, 13 Aug 2007 16:28:31 +0200 (CEST)
Subject: [Rd] Change in grep functionality causes Rd_db to fail silently
	(PR#9846)
Message-ID: <20070813142831.B5E4966826@slim.kubism.ku.dk>

Full_Name: Mike Pacey
Version: 2.5.1
OS: SUSE SE Linux 9.3
Submission from: (NULL) (194.80.32.10)



Versions 2.5.0 and 2.5.1 currently fail "make check" on my system due to a
silent failure in the call to Rd_db("base"):

-----
> ### Name: Rdutils
> ### Title: Rd Utilities
> ### Aliases: Rd_db Rd_parse
> ### Keywords: utilities documentation
> 
> ### ** Examples
> 
> ## Build the Rd db for the (installed) base package.
> db <- Rd_db("base")
> ## Run Rd_parse on all entries in the Rd db.
> db <- lapply(db, function(txt) Rd_parse(text = txt))
> ## Extract the metadata.
> meta <- lapply(db, "[[", "meta")
> 
> ## Keyword metadata per Rd file.
> keywords <- lapply(meta, "[[", "keywords")
> ## Tabulate the keyword entries.
> kw_table <- sort(table(unlist(keywords)))
Error in as.vector(x, mode) : invalid argument 'mode'
Execution halted
----

Tracing through the call to Rd_db, a call is made to list_files_with_exts(). The
functionality of the relevant section of that function in 2.4.0 is replicated
here:

> dir
[1] "/usr/local/packages/R-2.4.0-acml/lib64/R/library/base/man"
> files <- list.files(dir)
> files
[1] "base.Rd.gz"
> patt
[1] "\\.(Rd|rd|Rd.gz|rd.gz)$"
> grep(patt, files, value = TRUE)
[1] "base.Rd.gz"


In 2.5.1, the behaviour of grep() seems to have changed:

> dir
[1] "/usr/local/packages/src/R-2.5.1/library/base/man"
> files <- list.files(dir)
> files
[1] "base.Rd.gz"
> patt
[1] "\\.(Rd|rd|Rd.gz|rd.gz)$"
> grep(patt, files, value = TRUE)
character(0)

The result is that the call to Rd_db fails to find the relevant documentation
for the base package.



[Rd] Change in grep functionality causes Rd_db to fail silently (PR#9846)
m.pacey at lancaster.ac.uk