mirror of
https://github.com/containers/podman.git
synced 2025-06-27 21:50:18 +08:00
Use cleaned destination path for indexing image volumes
We use filepath.Clean() to remove trailing slashes to ensure that when we supercede image mounts with mounts from --volume and --mount, paths are consistent when we compare. Unfortunately, while we used the cleaned path for the destination in the mount, it was accidentally not used to index the maps that we use to identify what to supercede, so our comparisons might be thrown off by trailing slashes and similar. Fixes #5219 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:

committed by
Matthew Heon

parent
92dbcb8841
commit
40fa7e9931
@ -15,6 +15,10 @@ import (
|
||||
"github.com/onsi/gomega/gexec"
|
||||
)
|
||||
|
||||
var VolumeTrailingSlashDockerfile = `
|
||||
FROM alpine:latest
|
||||
VOLUME /test/`
|
||||
|
||||
var _ = Describe("Podman run with volumes", func() {
|
||||
var (
|
||||
tempdir string
|
||||
@ -421,4 +425,20 @@ var _ = Describe("Podman run with volumes", func() {
|
||||
Expect(len(outputArr)).To(Equal(1))
|
||||
Expect(strings.Contains(outputArr[0], fileName)).To(BeTrue())
|
||||
})
|
||||
|
||||
It("Podman mount over image volume with trailing /", func() {
|
||||
image := "podman-volume-test:trailing"
|
||||
podmanTest.BuildImage(VolumeTrailingSlashDockerfile, image, "false")
|
||||
|
||||
ctrName := "testCtr"
|
||||
create := podmanTest.Podman([]string{"create", "-v", "/tmp:/test", "--name", ctrName, image, "ls"})
|
||||
create.WaitWithDefaultTimeout()
|
||||
Expect(create.ExitCode()).To(Equal(0))
|
||||
|
||||
data := podmanTest.InspectContainer(ctrName)
|
||||
Expect(len(data)).To(Equal(1))
|
||||
Expect(len(data[0].Mounts)).To(Equal(1))
|
||||
Expect(data[0].Mounts[0].Source).To(Equal("/tmp"))
|
||||
Expect(data[0].Mounts[0].Destination).To(Equal("/test"))
|
||||
})
|
||||
})
|
||||
|
Reference in New Issue
Block a user