Skip to content

Commit 64342eb

Browse files
author
ripley
committed
intenral untar respects -p, wording tweaks
git-svn-id: https://svn.r-project.org/R/trunk@88367 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent dbfd818 commit 64342eb

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

doc/NEWS.Rd

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
\item \code{tcltk::tclVersion()} now only optionally includes the
4747
\sQuote{patch level}, as Tcl full versions can be of the form
4848
\code{8.7a5} or \code{9.0b1} without three clear components.
49+
50+
\item \code{untar(tar = "internal")} supports \code{extras =
51+
"-P"} to use unchanged the recorded file paths (as many external
52+
\command{tar} programs do).
4953
}
5054
}
5155
@@ -64,15 +68,11 @@
6468
}
6569
}
6670
67-
\subsection{INSTALLATION}{
71+
\subsection{INSTALLATION on a UNIX-ALIKE}{
6872
\itemize{
6973
\item \command{configure} appends \command{bsdtar} to the list of
7074
command names it tries when finding a default for \env{TAR}.
71-
}
72-
}
7375
74-
\subsection{INSTALLATION on a UNIX-ALIKE}{
75-
\itemize{
7676
\item Failures in building the documentation for the base packages,
7777
including from parsing their Rd files, are no longer ignored by
7878
\command{make docs}.
@@ -149,9 +149,10 @@
149149
Thanks to \I{Heather Turner}, \I{Ella Kaye}, and
150150
\I{Philippe Grosjean}.
151151

152-
\item \code{<Date> \%in\% set} has become as fast again, as it was
153-
before \R 4.3.0, via new S3 method \code{mtfrm.Date}.
154-
Additionally, \code{<character> \%in\% <Date>} and vice versa are
152+
\item \code{<Date> \%in\% set} has become as fast as it was
153+
before \R 4.3.0, \emph{via} a new S3 method \code{mtfrm.Date}.
154+
155+
\code{<character> \%in\% <Date>} and vice versa are now
155156
documented to work in concordance with \code{==} and as an exception
156157
to the typical \code{match()} behaviour which relies on
157158
\dQuote{univariate} \code{mtfrm()} alone.

src/library/utils/R/tar.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ untar <- function(tarfile, files = NULL, list = FALSE, exdir = ".",
2222
support_old_tars = Sys.getenv("R_SUPPORT_OLD_TARS", FALSE),
2323
tar = Sys.getenv("TAR"))
2424
{
25+
allow_all <- isTRUE(grepl("-P", extras))
2526
if (inherits(tarfile, "connection") || identical(tar, "internal")) {
2627
if (!missing(compressed))
2728
warning("argument 'compressed' is ignored for the internal method")
28-
return(untar2(tarfile, files, list, exdir, restore_times))
29+
return(untar2(tarfile, files, list, exdir, restore_times, allow_all))
2930
}
3031

3132
if (!(is.character(tarfile) && length(tarfile) == 1L))
@@ -37,7 +38,7 @@ untar <- function(tarfile, files = NULL, list = FALSE, exdir = ".",
3738
if (!nzchar(TAR) && .Platform$OS.type == "windows" &&
3839
nzchar(Sys.which("tar.exe"))) TAR <- "tar.exe"
3940
if (!nzchar(TAR) || TAR == "internal")
40-
return(untar2(tarfile, files, list, exdir))
41+
return(untar2(tarfile, files, list, exdir, restore_times, allow_all))
4142

4243
## The ability of external tar commands to handle compressed tarfiles
4344
## automagically varies and is poorly documented.
@@ -127,7 +128,7 @@ untar <- function(tarfile, files = NULL, list = FALSE, exdir = ".",
127128

128129
##' R's "internal" untar() -- called from untar(), *not* exported
129130
untar2 <- function(tarfile, files = NULL, list = FALSE, exdir = ".",
130-
restore_times = TRUE)
131+
restore_times = TRUE, allow_all_paths = FALSE)
131132
{
132133
## might be used with len = 12, so result of more than max int
133134
getOctD <- function(block, offset, len)

src/library/utils/man/untar.Rd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,9 @@ untar(tarfile, files = NULL, list = FALSE, exdir = ".",
207207
refuses to extract paths containing \code{".."} with the same
208208
workaround. The internal implementation removes leading slashes (with
209209
a warning) and stops with an error for paths starting with \code{"~"}
210-
or containing \code{".."}.
211-
212-
Extracted files will overwrite any existing file unless flag \option{-k}
210+
or containing \code{".."}, again unless \code{extras = "-P"} is specified.
211+
212+
Extracted files will overwrite existing file unless flag \option{-k}
213213
is included in \code{extras}.
214214
}
215215

0 commit comments

Comments
 (0)