Skip to content

Commit

Permalink
Merge pull request #2517 from QiWang19/i2509
Browse files Browse the repository at this point in the history
Don't extract tar file in podman cp
  • Loading branch information
openshift-merge-robot authored Mar 4, 2019
2 parents c07b55b + c8bf738 commit 8a90f83
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions cmd/podman/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand All @@ -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
}
Expand Down

0 comments on commit 8a90f83

Please sign in to comment.