Repository navigation
Do not raise ENOENT for a dangling symlink argument - #26
Open
carlosdanielpohlod wants to merge 1 commit into
Open
carlosdanielpohlod wants to merge 1 commit into
carlosdanielpohlod wants to merge 1 commit into
Conversation
Find.find checked its arguments with File.exist?, which follows symbolic links, so a dangling symlink was rejected as if it did not exist. The link itself is a valid entry: File.lstat succeeds on it, and one found during traversal is yielded like any other, as test_dangling_symlink asserts. Accept an argument that is a symlink, so passing a dangling one directly behaves the same as finding it inside a directory. Paths that really do not exist still raise Errno::ENOENT. Fixes ruby#18
carlosdanielpohlod
marked this pull request as ready for review
September 8, 2026 23:41
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.
Fixes #18.
Find.findrejects a dangling symlink passed as an argument:The same link is yielded normally when it is found during traversal, which
test_dangling_symlinkalready asserts:The argument check uses
File.exist?, which follows the link, so a dangling one looks missing. Everywhere else the module usesFile.lstat, which does not follow it. This accepts an argument that is a symlink, so both cases agree.Paths that really do not exist still raise
Errno::ENOENT;test_nonexistence([Bug #12087]) covers that.