Default .Options setting for unzip

Viewed 1441

I was trying to install ramnathv's slidify package and was surprised the by the following error:

# install.packages("devtools")
library(devtools)
install_github("slidify","ramnathv")
Installing github repo slidify/master from ramnathv
Downloading slidify.zip from https://github.com/ramnathv/slidify/archive/master.zip
Installing package from /tmp/RtmpOFEJuD/slidify.zip
Error in unzip(src, exdir = target, unzip = getOption("unzip")) : 
  'unzip' must be a single character string

I've installed it before with no issues on another system using the same Arch Linux setup and their R package, granted it was an earlier version of R (3.0.0 or 3.0.1).

In googling the error, it comes from this bit in zip.R:

unzip <-
    function(zipfile, files = NULL, list = FALSE, overwrite = TRUE,
             junkpaths = FALSE, exdir = ".", unzip = "internal",
             setTimes = FALSE)
{
    if(identical(unzip, "internal")) {
        if(!list && !missing(exdir))
            dir.create(exdir, showWarnings = FALSE, recursive = TRUE)
        res <- .External(C_unzip, zipfile, files, exdir, list, overwrite,
                         junkpaths, setTimes)
        if(list) {
            dates <- as.POSIXct(res[[3]], "%Y-%m-%d %H:%M",  tz="UTC")
            data.frame(Name = res[[1]], Length = res[[2]], Date = dates,
                       stringsAsFactors = FALSE)
        } else invisible(attr(res, "extracted"))
    } else {
        WINDOWS <- .Platform$OS.type == "windows"
        if(!is.character(unzip) || length(unzip) != 1L || !nzchar(unzip))
            stop("'unzip' must be a single character string")

...

While the default setting for unzip() is unzip = "internal", it can also be passed getOptions("unzip"):

Usage

unzip(zipfile, files = NULL, list = FALSE, overwrite = TRUE,
      junkpaths = FALSE, exdir = ".", unzip = "internal",
      setTimes = FALSE)

...

unzip
The method to be used. An alternative is to use getOption("unzip"),
which on a Unix-alike may be set to the path to a unzip program.

In looking at the output of .Options, I see, indeed, that there's nothing set for unzip:

> .Options$unzip
[1] ""

From perusing documentation, I see that I can set this in ~/.Renviron, but my question is whether on a Linux system this should be picked up by default or if it's pretty standard to have to set your unzip command?

If it's not standard that this be un-populated, I'll file a bug report with Arch Linux, as perhaps the package was compiled without this as a default, as documentation seems to suggest that it would be populated with an unzip command if one was found during installation:

unzip
a character string, the path of the command used for unzipping help files, or
"internal". Defaults to the value of R_UNZIPCMD, which is set in ‘etc/Renviron’
if an unzip command was found during configuration.

The Arch package I'm using is a binary and thus was pre-compiled, so intentionally or unintentionally perhaps this was overlooked or should be checked for during installation?


P.S. Just to avoid the obvious...

$ which unzip
/usr/bin/unzip
0 Answers
Related