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

Avoid race condition crash when a directory is swapped for a file #430

Closed
wants to merge 1 commit into from
Closed

Avoid race condition crash when a directory is swapped for a file #430

wants to merge 1 commit into from

Conversation

pR0Ps
Copy link
Contributor

@pR0Ps pR0Ps commented Dec 20, 2017

This commit builds off the race condition checking introduced in
2e83199, but also correctly handles the case where a directory is
replaced with a file before it can be walked.

For example:

  1. [external] create /a/b/c.txt
  2. [watchdog] walk /a (contains directory /a/b/ at this point)
  3. [external] rm -rf /a/b/
  4. [external] touch /a/b
  5. [watchdog] walk /a/b/ (raises NotADirectoryError)

This commit builds off the race condition checking introduced in
2e83199, but also correctly handles the case where a directory is
replaced with a file before it can be walked.

For example:
1. [external] create /a/b/c.txt
2. [watchdog] walk /a (contains directory /a/b/ at this point)
3. [external] rm -rf /a/b/
4. [external] touch /a/b
5. [watchdog] walk /a/b/ (raises NotADirectoryError)
@pR0Ps
Copy link
Contributor Author

pR0Ps commented Jan 26, 2018

@gorakhargosh Anything else I need to do for this?

@BoboTiG
Copy link
Collaborator

BoboTiG commented Sep 18, 2018

Hello @pR0Ps, thank you foryour interest.

Could you add test cases?
And also rebase your Pr on the master branch to benenfit of all the CI facilities.

@pR0Ps
Copy link
Contributor Author

pR0Ps commented Jan 23, 2019

Obsolete, see #513 for an updated PR

@pR0Ps pR0Ps closed this Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants