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

Ignore file if fs.stat returns an error #35

Closed
wants to merge 2 commits into from

Conversation

josiasmontag
Copy link

Currently, if fs.stat fails for one specific file, the complete recursive-readdir operation is aborted with an error.

I think we should change this behavior and just ignore the specific failing file instead of letting recursive-readdir completely fail.

Background:
In my case it is happening sometimes that a file is deleted in the time between the fs.readdir and the fs.stat operation of recursive-readdir. In this case fs.stat fails with ENOENT and makes recursive-readdir completely fail.

@jondcoleman
Copy link

Just ran into this issue. Would appreciate this merge.

@OlafRadicke
Copy link

But I think that is not a solution for this issue:
#42

@josiasmontag
Copy link
Author

@OlafRadicke Did you try? I think this change should also resolve your issue.

@OlafRadicke
Copy link

@josiasmontag I tested with my own script -> https://github.com/OlafRadicke/aguano
This script walk trow the directory and split the path parts and save these in a sqlite as key words.
Is in the directory a broken link than the liberty is get back null. Only null. All the other correct passes are discarded also.

@popod
Copy link

popod commented Oct 6, 2016

@jergason Why this commit is not merged into master ? I've the same issue with broken links.

@jergason
Copy link
Owner

jergason commented Oct 6, 2016

Can you help me understand what the issue with broken symbolic links is? If you call fs.stat on a broken symbolic link, it results in a ENOENT error, which breaks out of the recursion?

If that is the case, I could see a case for handling that case specifically, but this feels like too broad of a change for that.

@popod
Copy link

popod commented Oct 6, 2016

Yes, exactly. In my case, if there is broken links, I want not break the recursion and return all others files.

@niftylettuce
Copy link

Please merge

To make it possible to detect symlinks using isSymbolicLink
@jergason
Copy link
Owner

jergason commented Feb 5, 2017

I'm happy to revisit this if you handle the objection I specified: continuing on only ENOENT. I'm closing this PR but feel free to open another one handling that case specifically.

@jergason jergason closed this Feb 5, 2017
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.

6 participants