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

Fix broken symlink traversal issue #60

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

itsmunim
Copy link

@itsmunim itsmunim commented Mar 12, 2018

This issue #42 is pretty frequent in MacOSX and this is another stab at fixing the issue.
Has similar lstat approach as first appeared in #51, but addresses the problem without replacing/editing much code and keeping a minimal footprint yet similar signature in a refactored method.

Also, the expected behaviour for a broken symlink should be- if it was not possible to dive into it, then don't do it but add it to returned file list(instead of expecting some sort of check in provided ignores). Which is the exact behaviour in this PR.

dibosh added 4 commits March 12, 2018 01:45
  - Fallback to fs.lstat if fails (fs.stat fails for broken symlinks
    cause it looks up for original target, wherease fs.lstat only
    returns stat for the symlink file instead of looking up original)
  - For broken symlinks stats might be undefined and in other cases
    isSymbolicLink is available instead of isDirectory
  - Broken symlink will be added to files list as expected
@itsmunim
Copy link
Author

itsmunim commented Mar 12, 2018

@jergason can you please take a look and let know what do you think?

Copy link

@jrtechs jrtechs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dibosh Looks great! I came across a similar issue and developed a solution before realizing that you beet me too it 😄 I approve these changes however, it looks like the maintainer @jergason is not active? I guess that is why there are so many forks.

@itsmunim
Copy link
Author

@jrtechs haha! You are right- I wish there was one more maintainer and it was merged into the original one, am sure the more people will use it, the more they will end up in such cases.

@itsmunim
Copy link
Author

@jergason nudge after another couple years! Can this be merged? Or is it fixed already in any of the latest release? I would be happy to close it if it's not relevant anymore.

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.

2 participants