Skip to content

fs: fix glob early return skipping sibling entries - #64895

Open
webdevelopersrinu wants to merge 1 commit into
nodejs:mainfrom
webdevelopersrinu:fix-glob-sibling-skip
Open

fs: fix glob early return skipping sibling entries#64895
webdevelopersrinu wants to merge 1 commit into
nodejs:mainfrom
webdevelopersrinu:fix-glob-sibling-skip

Conversation

@webdevelopersrinu

Copy link
Copy Markdown

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.

This removes the check — the cache.add call at the start of the traversal
already 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/z are missing from the results for pattern a/**/../*,
in both the sync and async implementations).

Supersedes #62901 — the author there agreed to hand over the work
(#62901 (comment)).

Fixes: #62897

@nodejs-github-bot nodejs-github-bot added fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Aug 1, 2026
@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 21, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 21, 2026
@trivikr

trivikr commented Aug 21, 2026

Copy link
Copy Markdown
Member

@webdevelopersrinu Can you please sign the first commit and force push?

It's required as per updated instructions

Your commit must contain the Signed-off-by line with your name and email address as an acknowledgement that you agree to the Developer Certificate of Origin

@nodejs-github-bot

This comment was marked as outdated.

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>
Signed-off-by: webdevelopersrinu <webdeveloper.srinu9@gmail.com>
@webdevelopersrinu

Copy link
Copy Markdown
Author

@trivikr Done, pushed with the Signed-off-by line.

@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. label Aug 21, 2026
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.12%. Comparing base (a6a1bd4) to head (5247704).
⚠️ Report is 379 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #64895      +/-   ##
==========================================
- Coverage   90.14%   90.12%   -0.03%     
==========================================
  Files         746      752       +6     
  Lines      242846   252311    +9465     
  Branches    45771    47431    +1660     
==========================================
+ Hits       218909   227390    +8481     
- Misses      15439    16217     +778     
- Partials     8498     8704     +206     
Files with missing lines Coverage Δ
lib/internal/fs/glob.js 91.84% <ø> (+0.57%) ⬆️

... and 261 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trivikr trivikr added author ready PRs that have at least one approval, no outstanding review comments, and a CI started. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Aug 21, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fs.glob: return in cache-seen check aborts sibling processing, makes test-fs-glob.mjs flaky

4 participants