Skip to content
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

Better error handling in fsnotify recursive monitor #6949

Merged
merged 1 commit into from
Apr 26, 2018

Conversation

adriansr
Copy link
Contributor

@adriansr adriansr commented Apr 25, 2018

When the recursive file_monitor is scanning a directory, it will ignore paths that include an error. This is wrong, as sometimes those paths can still be processed. For example, a directory might not be readable, but the user wants to receive an event when it is created, even if its contents can't be known.

This has been uncovered by recent changes in how directory errors are reported by filepath.Walk, introduced in Go 1.10. Previously walkFn would be called twice. Once without an error (when the directory has been found during scan of the parent directory), and the second time with an error (when access to the directory is attempted).

Fixes auditbeat test failure in #6948

When the recursive `file_monitor` is scanning a directory, it will ignore
paths that include an error. This is wrong, as sometimes those paths can
still be processed. For example, a directory might not be readable, but
the user wants to receive an event when it is created, even if its
contents can't be known.

This has been uncovered by recent changes in how directory errors are
reported by `filepath.Walk`, introduced in Go 1.10. Previously `walkFn`
would be called twice. Once without an error (when the directory has
been found during scan of the parent directory), and the second time
with an error (when access to the directory is attempted).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants