summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-02-17 13:18:33 -0500
committerGitHub <noreply@github.com>2021-02-17 13:18:33 -0500
commitd48f4a0e1f3d24fb4f98351b5bdd31daa34c0fb6 (patch)
treeb1212d8483f5a4d641f129cbbb273f6be6574271 /libpod
parent6ea9ff2f21b583e4bc61a72d97c889ee7057a32e (diff)
parent759fc933438dead681a0c4f3d9e17826b0dc18cc (diff)
downloadpodman-d48f4a0e1f3d24fb4f98351b5bdd31daa34c0fb6.tar.gz
podman-d48f4a0e1f3d24fb4f98351b5bdd31daa34c0fb6.tar.bz2
podman-d48f4a0e1f3d24fb4f98351b5bdd31daa34c0fb6.zip
Merge pull request #9383 from mheon/fix_copyup_empty
Fix an issue where copyup could fail with ENOENT
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_internal.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index ced357096..ca0e082ff 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -1617,6 +1617,17 @@ func (c *Container) mountNamedVolume(v *ContainerNamedVolume, mountpoint string)
if !srcStat.IsDir() {
return vol, nil
}
+ // Read contents, do not bother continuing if it's empty. Fixes
+ // a bizarre issue where something copier.Get will ENOENT on
+ // empty directories and sometimes it will not.
+ // RHBZ#1928643
+ srcContents, err := ioutil.ReadDir(srcDir)
+ if err != nil {
+ return nil, errors.Wrapf(err, "error reading contents of source directory for copy up into volume %s", vol.Name())
+ }
+ if len(srcContents) == 0 {
+ return vol, nil
+ }
// Buildah Copier accepts a reader, so we'll need a pipe.
reader, writer := io.Pipe()