Merge pull request #2517 from QiWang19/i2509

Don't extract tar file in podman cp
This commit is contained in:
OpenShift Merge Robot
2019-03-04 07:39:03 -08:00
committed by GitHub

View File

@ -240,7 +240,6 @@ func copy(src, destPath, dest string, idMappingOpts storage.IDMappingOptions, ch
// return functions for copying items // return functions for copying items
copyFileWithTar := chrootarchive.CopyFileWithTarAndChown(chownOpts, digest.Canonical.Digester().Hash(), idMappingOpts.UIDMap, idMappingOpts.GIDMap) copyFileWithTar := chrootarchive.CopyFileWithTarAndChown(chownOpts, digest.Canonical.Digester().Hash(), idMappingOpts.UIDMap, idMappingOpts.GIDMap)
copyWithTar := chrootarchive.CopyWithTarAndChown(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() { if srcfi.IsDir() {
@ -263,6 +262,7 @@ func copy(src, destPath, dest string, idMappingOpts storage.IDMappingOptions, ch
if destfi != nil && destfi.IsDir() { if destfi != nil && destfi.IsDir() {
destPath = filepath.Join(destPath, filepath.Base(srcPath)) destPath = filepath.Join(destPath, filepath.Base(srcPath))
} }
}
// Copy the file, preserving attributes. // Copy the file, preserving attributes.
logrus.Debugf("copying %q to %q", srcPath, destPath) logrus.Debugf("copying %q to %q", srcPath, destPath)
if err = copyFileWithTar(srcPath, destPath); err != nil { if err = copyFileWithTar(srcPath, destPath); err != nil {
@ -270,13 +270,6 @@ func copy(src, destPath, dest string, idMappingOpts storage.IDMappingOptions, ch
} }
return nil 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)
}
return nil
}
func convertIDMap(idMaps []idtools.IDMap) (convertedIDMap []specs.LinuxIDMapping) { func convertIDMap(idMaps []idtools.IDMap) (convertedIDMap []specs.LinuxIDMapping) {
for _, idmap := range idMaps { for _, idmap := range idMaps {