-
-
Couldn't load subscription status.
- Fork 33.6k
module: fix EISDIR error with Windows drive-letter-only paths #60438
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
base: main
Are you sure you want to change the base?
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
|
Review requested:
|
|
Can you add a test that fails without this patch and pass with it? |
|
Okay commit node.js |
| if (ret && this[kNeedDrain]) { | ||
| this[kNeedDrain] = false; | ||
| this.emit('drain'); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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?
|
@ThierryMT, how is the change from |
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: