summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorAditya R <arajan@redhat.com>2022-07-01 13:49:28 +0530
committerAditya R <arajan@redhat.com>2022-07-01 14:19:01 +0530
commitd6678adc92b77db13db557a0381beff1c7da8549 (patch)
tree9b555a4a21b8c8d13f24ca75a1ed18fe32b56a14 /pkg
parent01beba3667851c1dd68d3df1e0aa6bc8cb1ec0eb (diff)
downloadpodman-d6678adc92b77db13db557a0381beff1c7da8549.tar.gz
podman-d6678adc92b77db13db557a0381beff1c7da8549.tar.bz2
podman-d6678adc92b77db13db557a0381beff1c7da8549.zip
overlay,mount: convert lowerdir to absolute path for overlay mounts of path
When mounting paths as overlay mounts we end up passing source as is to lowerdir options, resolve all relative paths in such cases for overlay mounts. Closes: https://github.com/containers/podman/issues/14797 Signed-off-by: Aditya R <arajan@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/specgen/volumes.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/specgen/volumes.go b/pkg/specgen/volumes.go
index f272a5c11..5e1ea9a78 100644
--- a/pkg/specgen/volumes.go
+++ b/pkg/specgen/volumes.go
@@ -139,7 +139,13 @@ func GenVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*Na
// This is a overlay volume
newOverlayVol := new(OverlayVolume)
newOverlayVol.Destination = dest
- newOverlayVol.Source = src
+ // convert src to absolute path so we don't end up passing
+ // relative values as lowerdir for overlay mounts
+ source, err := filepath.Abs(src)
+ if err != nil {
+ return nil, nil, nil, errors.Wrapf(err, "failed while resolving absolute path for source %v for overlay mount", src)
+ }
+ newOverlayVol.Source = source
newOverlayVol.Options = options
if _, ok := overlayVolumes[newOverlayVol.Destination]; ok {