Skip to content

Conversation

@Han5991
Copy link
Contributor

@Han5991 Han5991 commented Jan 3, 2026

fs.globSync failed with ENOTDIR when a path component in a glob pattern was a file but used as a directory (e.g., 'foo{,/bar}' when 'foo' is a file).

This change aligns getDirentSync with the asynchronous getDirent by wrapping the lstatSync call in a try-catch block to safely return null on such errors.

image

Fixes: #61257

@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 Jan 3, 2026
@codecov
Copy link

codecov bot commented Jan 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.53%. Comparing base (955d347) to head (4ddbabc).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #61259   +/-   ##
=======================================
  Coverage   88.52%   88.53%           
=======================================
  Files         704      704           
  Lines      208802   208804    +2     
  Branches    40318    40316    -2     
=======================================
+ Hits       184842   184856   +14     
+ Misses      15947    15925   -22     
- Partials     8013     8023   +10     
Files with missing lines Coverage Δ
lib/internal/fs/glob.js 91.40% <100.00%> (+0.02%) ⬆️

... and 35 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.

@Han5991 Han5991 requested a review from Renegade334 January 9, 2026 04:39
@Han5991 Han5991 force-pushed the fix/fs-glob-sync-enotdir branch from 285ded7 to d2e58e3 Compare January 9, 2026 04:59
@Renegade334 Renegade334 added request-ci Add this label to start a Jenkins CI on a PR. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels Jan 9, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 9, 2026
@nodejs-github-bot

This comment has been minimized.

@Han5991
Copy link
Contributor Author

Han5991 commented Jan 11, 2026

Thanks for the approval @Renegade334
It looks like there are some unrelated CI failures. Could you please trigger a re-run?

@Renegade334
Copy link
Member

Not until the security releases, no.

@Han5991
Copy link
Contributor Author

Han5991 commented Jan 11, 2026

Not until the security releases, no.

Understood. I'll wait until the security releases are out. Thanks for letting me know.

@Han5991
Copy link
Contributor Author

Han5991 commented Jan 16, 2026

Hello @Renegade334,
​Since the security releases are now out, could you please trigger the CI re-run?
​Thank you!

@nodejs-github-bot
Copy link
Collaborator

@Renegade334 Renegade334 added the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 17, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jan 17, 2026
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/61259
✔  Done loading data for nodejs/node/pull/61259
----------------------------------- PR info ------------------------------------
Title      fs: fix ENOTDIR in globSync when file is treated as dir (#61259)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     Han5991:fix/fs-glob-sync-enotdir -> nodejs:main
Labels     fs, needs-ci, commit-queue-squash
Commits    3
 - fs: fix ENOTDIR in globSync when file is treated as dir
 - Merge branch 'nodejs:main' into fix/fs-glob-sync-enotdir
 - fs: simplify getDirentSync lstatSync handling
Committers 2
 - sangwook <bnbt3@naver.com>
 - GitHub <noreply@github.com>
PR-URL: https://github.com/nodejs/node/pull/61259
Fixes: https://github.com/nodejs/node/issues/61257
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/61259
Fixes: https://github.com/nodejs/node/issues/61257
Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Sat, 03 Jan 2026 09:10:12 GMT
   ✔  Approvals: 1
   ✔  - René (@Renegade334): https://github.com/nodejs/node/pull/61259#pullrequestreview-3642642882
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2026-01-17T00:01:36Z: https://ci.nodejs.org/job/node-test-pull-request/70842/
- Querying data for job/node-test-pull-request/70842/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
- Downloading patch for 61259
From https://github.com/nodejs/node
 * branch                  refs/pull/61259/merge -> FETCH_HEAD
✔  Fetched commits as 4f6759b738ef..d2e58e34df54
--------------------------------------------------------------------------------
error: commit 1d288a6411f9cfe9eca016109602fdc49ab25425 is a merge but no -m option was given.
fatal: cherry-pick failed
[main accf352996] fs: fix ENOTDIR in globSync when file is treated as dir
 Author: sangwook <bnbt3@naver.com>
 Date: Sat Jan 3 18:06:19 2026 +0900
 2 files changed, 26 insertions(+), 4 deletions(-)
   ✘  Failed to apply patches
https://github.com/nodejs/node/actions/runs/21089928816

@Han5991 Han5991 force-pushed the fix/fs-glob-sync-enotdir branch from d2e58e3 to ce80c92 Compare January 17, 2026 06:43
Han5991 and others added 2 commits January 17, 2026 15:45
`fs.globSync` failed with `ENOTDIR` when a path component in a glob
pattern was a file but used as a directory (e.g., 'foo{,/bar}' when
'foo' is a file).

This change aligns `getDirentSync` with the asynchronous `getDirent`
by wrapping the `lstatSync` call in a `try-catch` block to safely
return `null` on such errors.

Fixes: nodejs#61257
Co-authored-by: René <contact.9a5d6388@renegade334.me.uk>
@Han5991 Han5991 force-pushed the fix/fs-glob-sync-enotdir branch from ce80c92 to 4ddbabc Compare January 17, 2026 06:46
@Han5991
Copy link
Contributor Author

Han5991 commented Jan 17, 2026

@Renegade334 I've addressed the commit-queue-failed issue by rebasing onto main and removing the merge commits from the history. Everything should be clean now. Could you please take a look again?

Thank you!

@Renegade334
Copy link
Member

The CQ failure was because you don't have a public e-mail address on your GH profile. Bear in mind that any pushes to your branch will invalidate all the checks, so this will need to be re-run

@Renegade334 Renegade334 added request-ci Add this label to start a Jenkins CI on a PR. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Jan 17, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jan 17, 2026
@nodejs-github-bot
Copy link
Collaborator

@Han5991
Copy link
Contributor Author

Han5991 commented Jan 17, 2026

@Renegade334 Thanks for letting me know about the missing email address. I've updated my profile settings to fix this. Thanks for your help as always.

@Renegade334 Renegade334 added the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 17, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 17, 2026
@nodejs-github-bot nodejs-github-bot merged commit 13a662f into nodejs:main Jan 17, 2026
66 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 13a662f

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

Labels

commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. 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.globSync fails when fs.glob does not

3 participants