Skip to content

Conversation

@ThierryMT
Copy link

Fixes #60435
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: ⚠️ 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 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
@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/http
  • @nodejs/loaders
  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added http Issues or PRs related to the http subsystem. module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run. labels Oct 27, 2025
@aduh95
Copy link
Contributor

aduh95 commented Oct 27, 2025

Can you add a test that fails without this patch and pass with it?

@Hritikk999
Copy link

Okay commit node.js

if (ret && this[kNeedDrain]) {
this[kNeedDrain] = false;
this.emit('drain');
}
Copy link
Member

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?

@StefanStojanovic
Copy link
Contributor

@ThierryMT, how is the change from lib/_http_outgoing.js related to the topic of this PR? I agree with a previous comment to add a test this patch fixes, so we are guarded against regressions.

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

Labels

http Issues or PRs related to the http subsystem. module Issues and PRs related to the module subsystem. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

child_process.execFileSync fails with EISDIR: illegal operation on a directory, lstat 'C:' on Windows in Node.js 22.20.0

6 participants