summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-09-13 16:36:21 +0200
committerGitHub <noreply@github.com>2019-09-13 16:36:21 +0200
commit5c09c4d2947a759724f9d5aef6bac04317e03f7e (patch)
tree288f53308185f1d423bcfd41a53859d67f5e4844 /cmd/podman
parentb095d8a794edaab3b2d622b6882bfd57fad8375e (diff)
parenta6836eae5280dafc9ce3703bd3bad5d6720ff32e (diff)
downloadpodman-5c09c4d2947a759724f9d5aef6bac04317e03f7e.tar.gz
podman-5c09c4d2947a759724f9d5aef6bac04317e03f7e.tar.bz2
podman-5c09c4d2947a759724f9d5aef6bac04317e03f7e.zip
Merge pull request #3942 from jwhonce/issue/3829
Stop glob'ing on podman cp
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/cp.go27
1 files changed, 6 insertions, 21 deletions
diff --git a/cmd/podman/cp.go b/cmd/podman/cp.go
index 5e1ca8312..661d0a530 100644
--- a/cmd/podman/cp.go
+++ b/cmd/podman/cp.go
@@ -52,7 +52,7 @@ func init() {
cpCommand.Command = _cpCommand
flags := cpCommand.Flags()
flags.BoolVar(&cpCommand.Extract, "extract", false, "Extract the tar file into the destination directory.")
- flags.BoolVar(&cpCommand.Pause, "pause", false, "Pause the container while copying")
+ flags.BoolVar(&cpCommand.Pause, "pause", true, "Pause the container while copying")
cpCommand.SetHelpTemplate(HelpTemplate())
cpCommand.SetUsageTemplate(UsageTemplate())
}
@@ -147,7 +147,6 @@ func copyBetweenHostAndContainer(runtime *libpod.Runtime, src string, dest strin
hostOwner := idtools.IDPair{UID: int(hostUID), GID: int(hostGID)}
- var glob []string
if isFromHostToCtr {
if isVol, volDestName, volName := isVolumeDestName(destPath, ctr); isVol {
path, err := pathWithVolumeMount(ctr, runtime, volDestName, volName, destPath)
@@ -209,13 +208,7 @@ func copyBetweenHostAndContainer(runtime *libpod.Runtime, src string, dest strin
srcPath = cleanedPath
}
}
- glob, err = filepath.Glob(srcPath)
- if err != nil {
- return errors.Wrapf(err, "invalid glob %q", srcPath)
- }
- if len(glob) == 0 {
- glob = append(glob, srcPath)
- }
+
if !filepath.IsAbs(destPath) {
dir, err := os.Getwd()
if err != nil {
@@ -224,19 +217,11 @@ func copyBetweenHostAndContainer(runtime *libpod.Runtime, src string, dest strin
destPath = filepath.Join(dir, destPath)
}
- var lastError error
- for _, src := range glob {
- if src == "-" {
- src = os.Stdin.Name()
- extract = true
- }
- err := copy(src, destPath, dest, idMappingOpts, &destOwner, extract, isFromHostToCtr)
- if lastError != nil {
- logrus.Error(lastError)
- }
- lastError = err
+ if src == "-" {
+ srcPath = os.Stdin.Name()
+ extract = true
}
- return lastError
+ return copy(srcPath, destPath, dest, idMappingOpts, &destOwner, extract, isFromHostToCtr)
}
func getUser(mountPoint string, userspec string) (specs.User, error) {