module: fix EISDIR error with Windows drive-letter-only paths#60438
Open
ThierryMT wants to merge 2 commits into
Open
module: fix EISDIR error with Windows drive-letter-only paths#60438ThierryMT wants to merge 2 commits into
ThierryMT wants to merge 2 commits into
Conversation
When using cork() and uncork() with ServerResponse, the drain event was not reliably emitted after uncorking. This occurred because the uncork() method did not check if a drain was pending (kNeedDrain flag) after flushing the chunked buffer. This fix ensures that when uncork() successfully flushes buffered data and a drain was needed, the drain event is emitted immediately. Fixes: nodejs#60432
When Windows long paths with \\?\ prefixes are processed during module resolution, the path can sometimes be reduced to just a drive letter (e.g., 'C:'), which causes fs.realpathSync to fail with EISDIR. This adds validation in toRealPath() to detect drive-letter-only paths and append a backslash to make them valid before calling realpathSync. Note: This addresses the immediate symptom. The root cause of why paths are being reduced to drive letters needs further investigation. Fixes: nodejs#60435
Collaborator
|
Review requested:
|
Contributor
|
Can you add a test that fails without this patch and pass with it? |
|
Okay commit node.js |
pimterry
reviewed
Oct 28, 2025
| if (ret && this[kNeedDrain]) { | ||
| this[kNeedDrain] = false; | ||
| this.emit('drain'); | ||
| } |
Member
There was a problem hiding this comment.
@ThierryMT it looks like these are the changes from #60437, which I think aren't directly related to this change.
Can you remove these HTTP changes so we can handle them separately in that other PR?
Contributor
|
@ThierryMT, how is the change from |
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.
Fixes #60435⚠️ This fix was developed on Linux and has not been tested on Windows. Windows testing is needed to verify the fix works correctly with long paths using the \?\ prefix. Additional Context: This fix addresses the immediate symptom. The root cause of why paths are being reduced to just drive letters during processing needs further investigation. ``
When Windows long paths with ?` prefixes are processed during module resolution, the path can sometimes be reduced to just a drive letter (e.g., 'C:'), which causes fs.realpathSync() to fail with EISDIR: illegal operation on a directory. The Fix: This adds validation in toRealPath() to detect drive-letter-only paths and append a backslash to make them valid ('C:') before calling realpathSync(). Changes: - Modified lib/internal/modules/helpers.js - Added Windows-specific check in toRealPath() function Testing Note: