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

javalib Files#walk FileSystemLoop detection is probably wrong/broken. #3903

Closed
LeeTibbert opened this issue May 4, 2024 · 1 comment
Closed

Comments

@LeeTibbert
Copy link
Contributor

Whilst studying Issue #3744, I have come to suspect that the algorithm in Files#walk to detect file
system cycles and throw FileSystemLoopException can report both false positives and, worse,
false negatives (i.e. loop without termination).

Files#find uses walk(), so it is suspect also.

I think I must plead guilty on this one, even in a community with a ego-less programming norm.

I am currently working on File.walkFileTree. If my suspicions about Files#walk tree bear out
I hope to fold the loop detection algorithm from there into its sibling Files#walk.

This is going to take a long while, so no problem if somebody gets there before me.
Hint: consider back-edges visited, where a back-edge can be a directory ancestor
of a link used to get to the current path or such a link itself.

@LeeTibbert
Copy link
Contributor Author

merged PR #3917 fixed a series of bugs with symlink cycle detection (Thank you Wojciech!).
In particular, it solved my concerns with false positives where a symlink referred to a previously visited regular file.
I think it also fixed my concern with false negatives.

I will open another Issue detailing two specific defects which still exist. Rome was not built in a day.

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

No branches or pull requests

1 participant