[Rd] R CMD check: Sys.getenv("R_GSCMD") cannot contain full pathname (contrary to docs)

From: Henrik Bengtsson <hb_at_biostat.ucsf.edu>
Date: Fri, 20 Apr 2012 14:00:08 -0700


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

Setting 'R_GSCMD' to "gswin32c.exe" and asserting that it is the PATH (this is on Windows), it works.

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.

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")
        else Sys.which("gs")
    } else {
      if (file.exists(gs_cmd) && !file.info(gs_cmd)$isdir)



> sessionInfo()
R version 2.15.0 Patched (2012-04-08 r58935) Platform: x86_64-pc-mingw32/x64 (64-bit)

[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[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 Received on Fri 20 Apr 2012 - 21:05:23 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 31 May 2012 - 06:12:09 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive