aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-03-04 07:39:03 -0800
committerGitHub <noreply@github.com>2019-03-04 07:39:03 -0800
commit8a90f83d18e1d94145dbf86a1ed12c47d0c98254 (patch)
tree86da5c6395a7ff579bebb6ca991d1f151346b751
parentc07b55b4a0ebc6f4a4bb7103272998cc1991e4e4 (diff)
parentc8bf73883cbb0e197eee197a89e60ff99f9f947b (diff)
downloadpodman-8a90f83d18e1d94145dbf86a1ed12c47d0c98254.tar.gz
podman-8a90f83d18e1d94145dbf86a1ed12c47d0c98254.tar.bz2
podman-8a90f83d18e1d94145dbf86a1ed12c47d0c98254.zip
Merge pull request #2517 from QiWang19/i2509
Don't extract tar file in podman cp
-rw-r--r--cmd/podman/cp.go15
1 files changed, 4 insertions, 11 deletions
diff --git a/cmd/podman/cp.go b/cmd/podman/cp.go
index 30b6d75d2..5958370b6 100644
--- a/cmd/podman/cp.go
+++ b/cmd/podman/cp.go
@@ -240,7 +240,6 @@ func copy(src, destPath, dest string, idMappingOpts storage.IDMappingOptions, ch
// return functions for copying items
copyFileWithTar := chrootarchive.CopyFileWithTarAndChown(chownOpts, digest.Canonical.Digester().Hash(), idMappingOpts.UIDMap, idMappingOpts.GIDMap)
copyWithTar := chrootarchive.CopyWithTarAndChown(chownOpts, digest.Canonical.Digester().Hash(), idMappingOpts.UIDMap, idMappingOpts.GIDMap)
- untarPath := chrootarchive.UntarPathAndChown(chownOpts, digest.Canonical.Digester().Hash(), idMappingOpts.UIDMap, idMappingOpts.GIDMap)
if srcfi.IsDir() {
@@ -263,17 +262,11 @@ func copy(src, destPath, dest string, idMappingOpts storage.IDMappingOptions, ch
if destfi != nil && destfi.IsDir() {
destPath = filepath.Join(destPath, filepath.Base(srcPath))
}
- // Copy the file, preserving attributes.
- logrus.Debugf("copying %q to %q", srcPath, destPath)
- if err = copyFileWithTar(srcPath, destPath); err != nil {
- return errors.Wrapf(err, "error copying %q to %q", srcPath, destPath)
- }
- return nil
}
- // We're extracting an archive into the destination directory.
- logrus.Debugf("extracting contents of %q into %q", srcPath, destPath)
- if err = untarPath(srcPath, destPath); err != nil {
- return errors.Wrapf(err, "error extracting %q into %q", srcPath, destPath)
+ // Copy the file, preserving attributes.
+ logrus.Debugf("copying %q to %q", srcPath, destPath)
+ if err = copyFileWithTar(srcPath, destPath); err != nil {
+ return errors.Wrapf(err, "error copying %q to %q", srcPath, destPath)
}
return nil
}