diff options
author | Eduardo Vega <edvegavalerio@gmail.com> | 2021-04-17 10:53:15 -0600 |
---|---|---|
committer | Eduardo Vega <edvegavalerio@gmail.com> | 2021-04-18 09:57:04 -0600 |
commit | 18d462c41bfa0d06353427d1abe2f60f0724d28d (patch) | |
tree | 21431c4730510587ae0932501db8049e52f5cb8a /pkg | |
parent | 6ff56ab50a10e2350013c4ff1bf4b8d5d7b5aa87 (diff) | |
download | podman-18d462c41bfa0d06353427d1abe2f60f0724d28d.tar.gz podman-18d462c41bfa0d06353427d1abe2f60f0724d28d.tar.bz2 podman-18d462c41bfa0d06353427d1abe2f60f0724d28d.zip |
Ensure mount destination is clean, no trailing slash
Signed-off-by: Eduardo Vega <edvegavalerio@gmail.com>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/specgen/generate/storage.go | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/pkg/specgen/generate/storage.go b/pkg/specgen/generate/storage.go index e135f4728..8066834f7 100644 --- a/pkg/specgen/generate/storage.go +++ b/pkg/specgen/generate/storage.go @@ -57,10 +57,13 @@ func finalizeMounts(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Ru } for _, m := range s.Mounts { - if _, ok := unifiedMounts[m.Destination]; ok { - return nil, nil, nil, errors.Wrapf(errDuplicateDest, "conflict in specified mounts - multiple mounts at %q", m.Destination) + // Ensure that mount dest is clean, so that it can be + // compared against named volumes and avoid duplicate mounts. + cleanDestination := filepath.Clean(m.Destination) + if _, ok := unifiedMounts[cleanDestination]; ok { + return nil, nil, nil, errors.Wrapf(errDuplicateDest, "conflict in specified mounts - multiple mounts at %q", cleanDestination) } - unifiedMounts[m.Destination] = m + unifiedMounts[cleanDestination] = m } for _, m := range commonMounts { |