[Rd] R CMD check: Sys.getenv("R_GSCMD") cannot contain full pathname (contrary to docs)
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Jun 5 12:45:39 CEST 2012
This is simply not true. Sys.which() should accept absolute paths,
and does on my systems (even my Windows system). However, it looks
like you gave an unescaped path containing spaces. Most likely you
need to include that path in double quotes (just as you would on a
Windows shell).
On Wed, 30 May 2012, Henrik Bengtsson wrote:
> Bump, in case it was missed. This is also the case with R Under
> development (unstable) (2012-05-25 r59443). /Henrik
>
> On Fri, Apr 20, 2012 at 2:00 PM, Henrik Bengtsson <hb at biostat.ucsf.edu> wrote:
>> Hi,
>>
>> in help("R_GSCMD") it says "R_GSCMD: Optional. The path to
>> Ghostscript, used by dev2bitmap, bitmap and embedFonts. Consulted when
>> those functions are invoked.". However, if 'R_GSCMD' contains a full
>> pathname to the Ghostscript executable (as above "path" indicates),
>> e.g.
>>
>>> Sys.getenv("R_GSCMD")
>> [1] "C:\\Program Files\\gs\\gs8.71\\bin\\gswin32c.exe"
>>
>> then 'R CMD check' will report
>>
>> * checking sizes of PDF files under 'inst/doc' ... NOTE
>> Unable to find GhostScript executable to run checks on size reduction
>>
>> Setting 'R_GSCMD' to "gswin32c.exe" and asserting that it is the PATH
>> (this is on Windows), it works.
>>
>>
>> TROUBLESHOOTING:
>> In the local function check_doc_size() of tools:::.check_packages()
>> [cf. http://svn.r-project.org/R/trunk/src/library/tools/R/check.R],
>> the Ghostscript executable is retrieved as:
>>
>> gs_cmd <- find_gs_cmd(Sys.getenv("R_GSCMD", ""))
>>
>> and if nzchar(gs_cmd) is FALSE, then the 'R CMD check' NOTE appears.
>> Inspecting tools:::find_gs_cmd, this corresponds to
>>
>> gs_cmd <- Sys.which(Sys.getenv("R_GSCMD", ""))
>>
>> iff 'R_GSCMD' is set. In other words, tools:::find_gs_cmd() assumes a
>> basename not a full pathname.
>>
>>
>> SUGGESTIONS:
>> Update tools:::find_gs_cmd() to test for file existence before turning
>> to Sys.which(), e.g.
>>
>> find_gs_cmd <- function (gs_cmd)
>> {
>> if (!nzchar(gs_cmd)) {
>> if (.Platform$OS.type == "windows") {
>> gs_cmd <- Sys.which("gswin64c")
>> if (!nzchar(gs_cmd))
>> gs_cmd <- Sys.which("gswin32c")
>> gs_cmd
>> }
>> else Sys.which("gs")
>> } else {
>> if (file.exists(gs_cmd) && !file.info(gs_cmd)$isdir)
>> gs_cmd
>> else
>> Sys.which(gs_cmd)
>> }
>> }
>>
>>
>> /Henrik
>>
>>> sessionInfo()
>> R version 2.15.0 Patched (2012-04-08 r58935)
>> Platform: x86_64-pc-mingw32/x64 (64-bit)
>>
>> locale:
>> [1] LC_COLLATE=English_United States.1252
>> [2] LC_CTYPE=English_United States.1252
>> [3] LC_MONETARY=English_United States.1252
>> [4] LC_NUMERIC=C
>> [5] LC_TIME=English_United States.1252
>>
>> attached base packages:
>> [1] stats graphics grDevices utils datasets methods base
>>
>> loaded via a namespace (and not attached):
>> [1] R.methodsS3_1.4.0 tools_2.15.0
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list