-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix infinite loop in isPathOnVolume #10238
Conversation
@@ -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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDK, but wonder if it would be better to add at line 134.5
if dest == "." {
return false}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me it looks good next to the check for "/"
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix.
Our CI enforces adding tests. Could you add a test with your reproducer to test/e2e/run_test.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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me it looks good next to the check for "/"
.
LGTM |
681aca4
to
7f7a7c2
Compare
@containers/podman-maintainers PTAL |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bacher09, mheon The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
filepath.Dir in some cases returns `.` symbol and calling this function again returns same result. In such cases this function never returns and causes some operations to stuck forever. Closes containers#10216 Signed-off-by: Slava Bacherikov <[email protected]>
Thanks @bacher09 |
filepath.Dir in some cases returns
.
symbol and calling this function again returns same result. In such cases this function never returns and causes some operations to stuck forever.Closes #10216