-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
fs: fix ENOTDIR in globSync when file is treated as dir #61259
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
fs: fix ENOTDIR in globSync when file is treated as dir #61259
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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
🚀 New features to boost your workflow:
|
285ded7 to
d2e58e3
Compare
This comment has been minimized.
This comment has been minimized.
|
Thanks for the approval @Renegade334 |
|
Not until the security releases, no. |
Understood. I'll wait until the security releases are out. Thanks for letting me know. |
|
Hello @Renegade334, |
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 patcheshttps://github.com/nodejs/node/actions/runs/21089928816 |
d2e58e3 to
ce80c92
Compare
`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>
ce80c92 to
4ddbabc
Compare
|
@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! |
|
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 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. |
|
Landed in 13a662f |
fs.globSyncfailed withENOTDIRwhen 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
getDirentSyncwith the asynchronousgetDirentby wrapping thelstatSynccall in atry-catchblock to safely returnnullon such errors.Fixes: #61257