-
Notifications
You must be signed in to change notification settings - Fork 63
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
pwalk, pwalkdir: fix walk vs remove race #204
Conversation
LGTM |
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.
overall LGTM (nice!), but found 2 redundant defers, and left a suggestion.
don't think they're necessarily show-stoppers, but I'll let @kolyshkin have a look before merging 👍
Use t.Helper and t.Cleanup in prepareTestSet to simplify tests setup and cleanup (no need to call defer os.Remove or check error). Signed-off-by: Kir Kolyshkin <[email protected]>
In some cases, when file walk is racing with removal, the ENOENT is received by filepath.Walk[Dir], rather than by the callback. Do ignore such errors, except for the root directory (Walk argument). Modify the doc accordingly, and add a couple of test cases. The "Race" test case, when testing the code before the fix, fails 100% of times for pwalk and 90% for pwalkdir. Alas, I was unable to make it fail 100% of the times without significantly increasing the test complexity. Fixes: 199 Signed-off-by: Kir Kolyshkin <[email protected]>
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.
LGTM, thanks!
@rhatdan PTAL
In some cases, when file walk is racing with removal, the ENOENT is
received by filepath.Walk[Dir], rather than by the callback.
Do ignore such errors, except for the root directory (Walk argument).
Modify the doc accordingly, and add a couple of test cases.
The "Race" test case, when testing the code before the fix, fails 100%
of times for pwalk and 90% for pwalkdir. Alas, I was unable to make it
fail 100% of the times without significantly increasing the test
complexity.
Fixes: #199