[Rd] corrupt PACKAGES.gz?

William Dunlap wdunlap at tibco.com
Fri Nov 6 18:54:32 CET 2015


Is it just me, or did a corrupt PACKAGES.gz file get installed in the
bin/windows/contrib/3.2 directory of CRAN mirrors recently?  gzfile()
complains about it and Cygwin's gzip cannot decompress it.  I tried the
following

repos <- "https://cran.rstudio.com"
v <- "3.2"
pkgs.gz <- paste(sep="/", repos, "bin/windows/contrib", v, "PACKAGES.gz")

tfile <- tempfile(fileext=".gz")
download.file(pkgs.gz, dest=tfile)
r.gz <- readLines(gzfile(tfile, "r"))
tail(system(paste("c:\\cygwin\\bin\\gzip -d - ", shQuote(tfile)),
intern=TRUE))

and got

> repos <- "https://cran.rstudio.com"
> v <- "3.2"
> pkgs.gz <- paste(sep="/", repos, "bin/windows/contrib", v, "PACKAGES.gz")
>
> tfile <- tempfile(fileext=".gz")
> download.file(pkgs.gz, dest=tfile)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/PACKAGES.gz'
Content type 'application/x-gzip' length 188174 bytes (183 KB)
downloaded 183 KB

> r.gz <- readLines(gzfile(tfile, "r"))
Warning message:
In readLines(gzfile(tfile, "r")) :
  seek on a gzfile connection returned an internal error
> tail(system(paste("c:\\cygwin\\bin\\gzip -d - ", shQuote(tfile)),
intern=TRUE))
[1] ""                                    "gzip: stdin: unexpected end of
file"
Warning message:
running command 'c:\cygwin\bin\gzip -d -
 "C:\Users\wdunlap\AppData\Local\Temp\RtmpG42jk4\file2a201a9e4802.gz"' had
status 1

R's gz code seems to recover from the bad seek, but Cygwin's gzip cannot.

> pkgs <- paste(sep="/", repos, "bin/windows/contrib", v, "PACKAGES")
> r <- readLines(url(pkgs, "rt"))
> all.equal(r, r.gz)
[1] TRUE

I get the same results using the Spanish miror, https://ftp.cixug.es/CRAN


Bill Dunlap
TIBCO Software
wdunlap tibco.com

	[[alternative HTML version deleted]]



More information about the R-devel mailing list