mirror of https://github.com/containers/podman.git
Merge pull request #10238 from bacher09/fix-inf-loop
Fix infinite loop in isPathOnVolume
This commit is contained in:
commit
41ac68d197
|
@ -128,7 +128,7 @@ func isPathOnVolume(c *Container, containerPath string) bool {
|
|||
if cleanedContainerPath == filepath.Clean(vol.Dest) {
|
||||
return true
|
||||
}
|
||||
for dest := vol.Dest; dest != "/"; dest = filepath.Dir(dest) {
|
||||
for dest := vol.Dest; dest != "/" && dest != "."; dest = filepath.Dir(dest) {
|
||||
if cleanedContainerPath == dest {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -921,6 +921,17 @@ USER mail`, BB)
|
|||
Expect(session.OutputToString()).To(ContainSubstring("mail root"))
|
||||
})
|
||||
|
||||
It("podman run with incorect VOLUME", func() {
|
||||
dockerfile := fmt.Sprintf(`FROM %s
|
||||
VOLUME ['/etc/foo']
|
||||
WORKDIR /etc/foo`, BB)
|
||||
podmanTest.BuildImage(dockerfile, "test", "false")
|
||||
session := podmanTest.Podman([]string{"run", "--rm", "test", "echo", "test"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session.ExitCode()).To(Equal(0))
|
||||
Expect(session.OutputToString()).To(ContainSubstring("test"))
|
||||
})
|
||||
|
||||
It("podman run --volumes-from flag", func() {
|
||||
vol := filepath.Join(podmanTest.TempDir, "vol-test")
|
||||
err := os.MkdirAll(vol, 0755)
|
||||
|
|
Loading…
Reference in New Issue