fs: fix glob early return skipping sibling entries - #64895
Open
webdevelopersrinu wants to merge 1 commit into
Open
fs: fix glob early return skipping sibling entries#64895webdevelopersrinu wants to merge 1 commit into
webdevelopersrinu wants to merge 1 commit into
Conversation
The children loop in the glob traversal returned from the whole method when a child path had already been seen through a different pattern context, silently dropping the remaining sibling entries. Whether this triggered depended on directory iteration order, which also made test-fs-glob.mjs flaky. Remove the check: the cache.add call at the start of the traversal already prevents reprocessing. Fixes: nodejs#62897 Co-authored-by: semimikoh <ejffjeosms@gmail.com>
avivkeller
approved these changes
Aug 1, 2026
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.
The children loop in the glob traversal returned from the whole method when a
child path had already been seen through a different pattern context, silently
dropping the remaining sibling entries. Whether this triggered depended on
directory iteration order, which also made
test-fs-glob.mjsflaky.This removes the check — the
cache.addcall at the start of the traversalalready prevents reprocessing. Deno, which ports this implementation, fixed
the same bug.
The regression test pins the directory iteration order that triggers the bug,
so it fails deterministically without the fix (verified: without the fix,
a/b,a/x,a/zare missing from the results for patterna/**/../*,in both the sync and async implementations).
Supersedes #62901 — the author there agreed to hand over the work
(#62901 (comment)).
Fixes: #62897