diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-10-11 20:44:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-11 20:44:13 +0200 |
commit | 33c3f1849b6e2e644a554a8f38266e51df7d5258 (patch) | |
tree | 921cd9cd825312478cbf366701e3f26e0eff86bf | |
parent | fc10d7d55f97daa500ff3148673dac7409b07d96 (diff) | |
parent | 0ec4e90eaecfe4e7a0ff2fbfb409edee41494e5e (diff) | |
download | podman-33c3f1849b6e2e644a554a8f38266e51df7d5258.tar.gz podman-33c3f1849b6e2e644a554a8f38266e51df7d5258.tar.bz2 podman-33c3f1849b6e2e644a554a8f38266e51df7d5258.zip |
Merge pull request #4172 from haircommander/cp-fix-1.4.2-stable
[1.4.2-stable] Stop glob-ing on podman cp
-rw-r--r-- | cmd/podman/cp.go | 27 |
1 files changed, 6 insertions, 21 deletions
diff --git a/cmd/podman/cp.go b/cmd/podman/cp.go index a9418e6e0..07687b195 100644 --- a/cmd/podman/cp.go +++ b/cmd/podman/cp.go @@ -51,7 +51,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()) rootCmd.AddCommand(cpCommand.Command) @@ -143,7 +143,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) @@ -204,13 +203,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 { @@ -219,19 +212,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, &containerOwner, 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, &containerOwner, extract, isFromHostToCtr) } func getUser(mountPoint string, userspec string) (specs.User, error) { |