summaryrefslogtreecommitdiff
path: root/pkg/domain
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-02-19 12:51:23 -0500
committerGitHub <noreply@github.com>2021-02-19 12:51:23 -0500
commit4d64dd2d60cf468d52987690728cf7f3bc445cce (patch)
tree64b61c1bdbfa84528b3380b75055647bbfa5d461 /pkg/domain
parent7e286bc430ea50b72e972e48626298ac2e1f258a (diff)
parenta3c8782998140d4203a71fd0cdded9fde55550eb (diff)
downloadpodman-4d64dd2d60cf468d52987690728cf7f3bc445cce.tar.gz
podman-4d64dd2d60cf468d52987690728cf7f3bc445cce.tar.bz2
podman-4d64dd2d60cf468d52987690728cf7f3bc445cce.zip
Merge pull request #9435 from vrothberg/3.0-cp-content-fix
[3.0] cp: treat "." and "/." correctly
Diffstat (limited to 'pkg/domain')
-rw-r--r--pkg/domain/infra/abi/archive.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/pkg/domain/infra/abi/archive.go b/pkg/domain/infra/abi/archive.go
index c64dfb02a..f38f5c132 100644
--- a/pkg/domain/infra/abi/archive.go
+++ b/pkg/domain/infra/abi/archive.go
@@ -3,6 +3,7 @@ package abi
import (
"context"
"io"
+ "path/filepath"
"strings"
buildahCopiah "github.com/containers/buildah/copier"
@@ -93,7 +94,7 @@ func (ic *ContainerEngine) ContainerCopyToArchive(ctx context.Context, nameOrID
containerPath = "/."
}
- _, resolvedRoot, resolvedContainerPath, err := ic.containerStat(container, containerMountPoint, containerPath)
+ statInfo, resolvedRoot, resolvedContainerPath, err := ic.containerStat(container, containerMountPoint, containerPath)
if err != nil {
unmount()
return nil, err
@@ -110,8 +111,8 @@ func (ic *ContainerEngine) ContainerCopyToArchive(ctx context.Context, nameOrID
return func() error {
defer container.Unmount(false)
getOptions := buildahCopiah.GetOptions{
- // Unless the specified path ends with ".", we want to copy the base directory.
- KeepDirectoryNames: !strings.HasSuffix(resolvedContainerPath, "."),
+ // Unless the specified points to ".", we want to copy the base directory.
+ KeepDirectoryNames: statInfo.IsDir && filepath.Base(containerPath) != ".",
UIDMap: idMappings.UIDMap,
GIDMap: idMappings.GIDMap,
ChownDirs: idPair,