summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-05-07 05:33:25 -0400
committerGitHub <noreply@github.com>2021-05-07 05:33:25 -0400
commit41ac68d197b53f3c151b81e2eddbc00bcf1a117f (patch)
tree980ff63c26b7b8fffd84724bd0815a2e4755412d
parent29b13176a2f80728f5f8534e925d03f3c4ab51e3 (diff)
parentd6fd5289008c595c0aa49e9f9d06632795adca82 (diff)
downloadpodman-41ac68d197b53f3c151b81e2eddbc00bcf1a117f.tar.gz
podman-41ac68d197b53f3c151b81e2eddbc00bcf1a117f.tar.bz2
podman-41ac68d197b53f3c151b81e2eddbc00bcf1a117f.zip
Merge pull request #10238 from bacher09/fix-inf-loop
Fix infinite loop in isPathOnVolume
-rw-r--r--libpod/container_path_resolution.go2
-rw-r--r--test/e2e/run_test.go11
2 files changed, 12 insertions, 1 deletions
diff --git a/libpod/container_path_resolution.go b/libpod/container_path_resolution.go
index d798963b1..ec7306ca1 100644
--- a/libpod/container_path_resolution.go
+++ b/libpod/container_path_resolution.go
@@ -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
}
diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go
index d8d7dab07..9976e743a 100644
--- a/test/e2e/run_test.go
+++ b/test/e2e/run_test.go
@@ -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)