Fix infinite loop setting up the inotify tree with recursive symbolic links on Linux#41
Closed
nathansobo wants to merge 2 commits intoAxosoft:masterfrom
Closed
Fix infinite loop setting up the inotify tree with recursive symbolic links on Linux#41nathansobo wants to merge 2 commits intoAxosoft:masterfrom
nathansobo wants to merge 2 commits intoAxosoft:masterfrom
Conversation
added 2 commits
October 27, 2017 16:48
This prevents an endless loop in the face of recursive symbolic links. Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Signed-off-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Tyriar
reviewed
Oct 27, 2017
| { | ||
| "name": "nsfw", | ||
| "version": "1.0.16", | ||
| "name": "@atom/nsfw", |
Contributor
There was a problem hiding this comment.
I'm guessing this was unintentional
Contributor
Author
There was a problem hiding this comment.
Oh yeah, that shouldn't be in this PR. Thanks!
Contributor
|
Looks like this PR fixes #40 |
bb28461 to
b77e49a
Compare
Contributor
|
Looks like a lot of tests are failing, any reason why? @nathansobo |
implausible
suggested changes
Nov 28, 2017
| () => {}, | ||
| { debounceMS: DEBOUNCE, errorCallback() {} } | ||
| ).then((watch) => { | ||
| return watch.start(); |
Contributor
There was a problem hiding this comment.
You need to stop this watcher or the tests are never going to finish.
Contributor
|
@nathansobo Any chance you will get to this? |
Contributor
Author
|
@implausible Probably not. I opened the PR as a courtesy but we plan to transition away from this library this year so it's hard to justify spending more time on it. I'm sorry. I'll go ahead and close. |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, when constructing the
InotifyTree, this library would unconditionally follow all symbolic links, even if they pointed to an ancestor of the current path. This would lead to infinite recursion building out a deeper and deeper tree until the process ran out of memory.In this PR, we associate the tree with an
std::unordered_setof inode numbers. These are already obtained in the common case of walking each directory's children viastatcalls. We've had to add a couple morestatcalls to get the inode of the root of the tree and of any newly added directories.Now, when processing a directory's children, we only proceed if the inode number associated with the child has never been seen before.
We've added a basic new test with a simple recursive link where we just ensure the test does not time out. We've also run this under
valgrindand haven't noticed any abnormal behavior associated with the newly added code.