[Rd] possible internal (un)tar bug

Martin Maechler m@echler @ending from @t@t@m@th@ethz@ch
Tue May 1 16:14:43 CEST 2018


>>>>> Gábor Csárdi <csardi.gabor at gmail.com>
>>>>>     on Tue, 1 May 2018 12:05:32 +0000 writes:

    > This is a not too old R-devel on Linux, it already fails
    > in R 3.4.4, and on macOS as well.

and fails in considerably older R versions, too.

Basically  untar() seems to fail on a connection, but works fine
on a plain file name.

This is a bug --> Thank you for the report, Gábor !

I'm investigating.
Martin

----------- my version of your reprex :

setwd(tempdir())
dir.create("pkg")
cat("this: that\n", file = file.path("pkg", "DESCRIPTION"))
tf <- "pkg_1.0.tar.gz"
tar(tf, "pkg", compression = "gzip", tar = "internal")
unlink("pkg", recursive = TRUE)

## MM: tar *file* is good
stopifnot(identical(untar(tf, list=TRUE), "pkg/DESCRIPTION"))
untar(tf, files = (f <- "pkg/DESCRIPTION")) # no problem
stopifnot(file.exists(f))
unlink("pkg", recursive = TRUE)

## Now with a connection -- "nothing works":
con <- file(tf, open = "rb"); try( untar(con, list = TRUE) ) ## -> Error
con <- file(tf, open = "rb"); try( untar(con, files = "pkg/DESCRIPTION") )
## The error message is the same in both cases:
'
Error in untar2(tarfile, files, list, exdir, restore_times) :
   incomplete block on file
'




More information about the R-devel mailing list