From wdunlap at tibco.com  Fri Nov  6 18:54:32 2015
From: wdunlap at tibco.com (William Dunlap)
Date: Fri, 6 Nov 2015 09:54:32 -0800
Subject: [Rd] corrupt PACKAGES.gz?
Message-ID: <CAF8bMcZAPm5Q7VNcB+ofa-y6D0e2eYSokB9cD9mDXmS88yCzDg@mail.gmail.com>

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]]



[Rd] corrupt PACKAGES.gz?
William Dunlap