Repository navigation
fs: restore stack traces of fs/promises stat permission errors - #67525
Merged
nodejs-github-bot merged 1 commit intoNov 19, 2026
Merged
Conversation
Since stat() started going through raceWithSignal(), permission errors from fsPromises.stat() have had no stack frames. The binding rejects them right away, and raceWithSignal() returned that promise from an async function without awaiting it, so nothing was awaiting it yet when the stack was captured. Return the promise as is when there is no signal, so stat() awaits it directly again. Refs: nodejs#63143 Signed-off-by: vedchaudhari <vedc2853@gmail.com>
Collaborator
|
Review requested:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #67525 +/- ##
==========================================
+ Coverage 90.66% 90.67% +0.01%
==========================================
Files 799 799
Lines 280252 280318 +66
Branches 54121 54134 +13
==========================================
+ Hits 254088 254182 +94
+ Misses 16285 16243 -42
- Partials 9879 9893 +14
🚀 New features to boost your workflow:
|
jasnell
approved these changes
Nov 18, 2026
Collaborator
Collaborator
Collaborator
|
Landed in cdd0687 |
aduh95
pushed a commit
that referenced
this pull request
Nov 19, 2026
Since stat() started going through raceWithSignal(), permission errors from fsPromises.stat() have had no stack frames. The binding rejects them right away, and raceWithSignal() returned that promise from an async function without awaiting it, so nothing was awaiting it yet when the stack was captured. Return the promise as is when there is no signal, so stat() awaits it directly again. Refs: #63143 Signed-off-by: vedchaudhari <vedc2853@gmail.com> PR-URL: #67525 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Christian Aurich Zanettini Martins <christian.aurichzm@gmail.com>
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.
Since #63143, errors from
fs.promises.stat()have no stack frames when the permission model denies access. This affects v26.8.0+; v26.7.0, v24.x and v22.x aren't affected.The binding rejects a denied
stat()right away, andraceWithSignal()returned that promise from an async function without awaiting it, so nothing was awaiting it yet when the stack was captured. This returns the promise as is when there's no signal, sostat()awaits it directly like before. With a signal, nothing changes. It's the same problem as theappendFile()case in #66757.Added a case to the test from #66757; it fails on
mainand passes with this change. Tested on Windows x64.cc @mertcanaltin @christianaurichzm
AI-assisted. I reproduced the bug and ran the tests myself.