GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — module,win: fix long path resolve by StefanStojanovic · Pull Request #51097 · nodejs/node

Conversation

@StefanStojanovic

@StefanStojanovic StefanStojanovic commented Dec 8, 2023

Copy link
Copy Markdown
Contributor

As reported here, there is a problem loading modules from long paths on Windows. This change fixes it by adding the required \\?\ prefix, with which, resolving long paths will work regardless of whether the LongPathsEnabled value is set or not.

Fixes: #50753

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

karlhorky, bricss, and hsjoberg reacted with heart emoji JakobJingleheimer and bricss reacted with eyes emoji
All reactions
  • ❤️ 3 reactions
  • 👀 2 reactions
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to file-system APIs and the fs module. needs-ci PRs that need a full CI run. labels Dec 8, 2023
anonrig
anonrig reviewed Dec 8, 2023
View reviewed changes

@anonrig anonrig left a comment

Copy link
Copy Markdown
Member

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.

Can we add a test so we don't regress?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@richardlau

richardlau commented Dec 8, 2023

Copy link
Copy Markdown
Member

FYI @nodejs/loaders @nodejs/fs

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StefanStojanovic

StefanStojanovic commented Dec 8, 2023

Copy link
Copy Markdown
Contributor Author

Can we add a test so we don't regress?

Of course. I'll add it next week.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StefanStojanovic
StefanStojanovic force-pushed the mefi-resolve-long-path branch from e74bcf7 to ec2ea14 Compare December 15, 2023 10:00
@StefanStojanovic

StefanStojanovic commented Dec 15, 2023

Copy link
Copy Markdown
Contributor Author

Can we add a test so we don't regress?

Test's added.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

joyeecheung
joyeecheung reviewed Dec 18, 2023
View reviewed changes

@joyeecheung joyeecheung left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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.

This looks like a regression from #50322, probably from not porting the logic in path.toNamespacedPath() properly

node/lib/path.js

Lines 632 to 648 in b7def8e

if (StringPrototypeCharCodeAt(resolvedPath, 0) === CHAR_BACKWARD_SLASH) {
// Possible UNC root
if (StringPrototypeCharCodeAt(resolvedPath, 1) === CHAR_BACKWARD_SLASH) {
const code = StringPrototypeCharCodeAt(resolvedPath, 2);
if (code !== CHAR_QUESTION_MARK && code !== CHAR_DOT) {
// Matched non-long UNC root, convert the path to a long UNC path
return `\\\\?\\UNC\\${StringPrototypeSlice(resolvedPath, 2)}`;
}
}
} else if (
isWindowsDeviceRoot(StringPrototypeCharCodeAt(resolvedPath, 0)) &&
StringPrototypeCharCodeAt(resolvedPath, 1) === CHAR_COLON &&
StringPrototypeCharCodeAt(resolvedPath, 2) === CHAR_BACKWARD_SLASH
) {
// Matched device root, convert the path to a long UNC path
return `\\\\?\\${resolvedPath}`;
}

We should probably port the entire logic over (with a helper that's named something like ToNamespacedPath declared in either util.h or node_internals.h)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@StefanStojanovic

StefanStojanovic commented Feb 8, 2024

Copy link
Copy Markdown
Contributor Author

@joyeecheung do you think this can land as a fix with a regression test added and then a follow-up PR can be opened for porting path.toNamespacedPath() logic and using it in here, but potentially in other places missing it as well?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joyeecheung

joyeecheung commented Feb 8, 2024

Copy link
Copy Markdown
Member

Yes, with a TODO/FIXME comment.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StefanStojanovic
StefanStojanovic force-pushed the mefi-resolve-long-path branch from ec2ea14 to 3f957e8 Compare February 9, 2024 09:54
@StefanStojanovic

StefanStojanovic commented Feb 9, 2024

Copy link
Copy Markdown
Contributor Author

@joyeecheung LGTY now?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StefanStojanovic
StefanStojanovic force-pushed the mefi-resolve-long-path branch 3 times, most recently from e72e49a to 4e651a1 Compare February 9, 2024 13:22
joyeecheung
joyeecheung approved these changes Feb 20, 2024
View reviewed changes
@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Feb 20, 2024
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Feb 20, 2024
@nodejs-github-bot

nodejs-github-bot commented Feb 20, 2024

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/57224/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@RexSkz RexSkz mentioned this pull request Feb 28, 2024
How commit all patches at onece? pnpm/pnpm#7291
Closed
1 task
@nodejs-github-bot

nodejs-github-bot commented Feb 29, 2024

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/57499/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Feb 29, 2024

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/57500/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StefanStojanovic
module,win: fix long path resolve
93dc8cb
Fixes: nodejs#50753
@StefanStojanovic
StefanStojanovic force-pushed the mefi-resolve-long-path branch from 4e651a1 to 93dc8cb Compare February 29, 2024 20:39
@aduh95 aduh95 added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Mar 1, 2024
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Mar 1, 2024
@nodejs-github-bot

nodejs-github-bot commented Mar 1, 2024

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/57517/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joyeecheung joyeecheung added the commit-queue PRs queued for automated landing through the Commit Queue. label Mar 1, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Mar 1, 2024
@nodejs-github-bot

nodejs-github-bot commented Mar 19, 2024

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/57848/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StefanStojanovic

StefanStojanovic commented Apr 1, 2024

Copy link
Copy Markdown
Contributor Author

@joyeecheung can you add the commit-queue label to try to land this again? Last time it failed to do so...

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joyeecheung joyeecheung added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Apr 1, 2024
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Apr 1, 2024
@nodejs-github-bot

nodejs-github-bot commented Apr 1, 2024

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/58036/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@karlhorky

karlhorky commented Apr 3, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

@StefanStojanovic @joyeecheung any chance of getting this released in one of the next patch or minor releases?

It's been a while since my original issue in Nov 2023 and users keep running into this (eg. with pnpm) and commenting that it's an open bug but the PR hasn't been merged yet.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@karlhorky karlhorky mentioned this pull request Apr 5, 2024
Bug: Long node_modules plugin paths cannot be found on Windows eslint/eslint#17763
Closed
1 task
@zkochan zkochan mentioned this pull request Apr 7, 2024
feat(dlx): cache pnpm/pnpm#7835
Merged
11 tasks done
@joyeecheung joyeecheung added the commit-queue PRs queued for automated landing through the Commit Queue. label Apr 8, 2024
@nodejs-github-bot nodejs-github-bot added commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. and removed commit-queue PRs queued for automated landing through the Commit Queue. labels Apr 8, 2024
@nodejs-github-bot

nodejs-github-bot commented Apr 8, 2024

Copy link
Copy Markdown
Collaborator
Commit Queue failed
- Loading data for nodejs/node/pull/51097
✔  Done loading data for nodejs/node/pull/51097
----------------------------------- PR info ------------------------------------
Title      module,win: fix long path resolve (#51097)
   ⚠  Could not retrieve the email or name of the PR author's from user's GitHub profile!
Branch     StefanStojanovic:mefi-resolve-long-path -> nodejs:main
Labels     c++, fs, needs-ci
Commits    1
 - module,win: fix long path resolve
Committers 1
 - StefanStojanovic 
PR-URL: https://github.com/nodejs/node/pull/51097
Fixes: https://github.com/nodejs/node/issues/50753
Reviewed-By: Joyee Cheung 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/51097
Fixes: https://github.com/nodejs/node/issues/50753
Reviewed-By: Joyee Cheung 
--------------------------------------------------------------------------------
   ⚠  Commits were pushed since the last approving review:
   ⚠  - module,win: fix long path resolve
   ℹ  This PR was created on Fri, 08 Dec 2023 13:28:00 GMT
   ✔  Approvals: 1
   ✔  - Joyee Cheung (@joyeecheung) (TSC): https://github.com/nodejs/node/pull/51097#pullrequestreview-1891732903
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2024-04-01T17:51:22Z: https://ci.nodejs.org/job/node-test-pull-request/58036/
- Querying data for job/node-test-pull-request/58036/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/8596048782
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@StefanStojanovic

StefanStojanovic commented Apr 8, 2024

Copy link
Copy Markdown
Contributor Author

Commit Queue failed

  • Loading data for module,win: fix long path resolve #51097
    ✔ Done loading data for module,win: fix long path resolve #51097
    ----------------------------------- PR info ------------------------------------
    Title module,win: fix long path resolve (module,win: fix long path resolve #51097)
    ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile!
    Branch StefanStojanovic:mefi-resolve-long-path -> nodejs:main
    Labels c++, fs, needs-ci
    Commits 1
  • module,win: fix long path resolve
    Committers 1
  • StefanStojanovic
    PR-URL: module,win: fix long path resolve #51097
    Fixes: Long node_modules paths cannot be found on Windows when LongPathsEnabled enabled #50753
    Reviewed-By: Joyee Cheung
    ------------------------------ Generated metadata ------------------------------
    PR-URL: module,win: fix long path resolve #51097
    Fixes: Long node_modules paths cannot be found on Windows when LongPathsEnabled enabled #50753
    Reviewed-By: Joyee Cheung

⚠ Commits were pushed since the last approving review:
⚠ - module,win: fix long path resolve
ℹ This PR was created on Fri, 08 Dec 2023 13:28:00 GMT
✔ Approvals: 1
✔ - Joyee Cheung (@joyeecheung) (TSC): #51097 (review)
✔ Last GitHub CI successful
ℹ Last Full PR CI on 2024-04-01T17:51:22Z: https://ci.nodejs.org/job/node-test-pull-request/58036/

  • Querying data for job/node-test-pull-request/58036/
    ✔ Last Jenkins CI successful

✔ Aborted git node land session in /home/runner/work/node/node/.ncu
https://github.com/nodejs/node/actions/runs/8596048782

@joyeecheung do you see why this couldn't land from this log?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

joyeecheung
joyeecheung approved these changes Apr 8, 2024
View reviewed changes
@joyeecheung joyeecheung added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. and removed commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. labels Apr 8, 2024
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Apr 8, 2024
@nodejs-github-bot

nodejs-github-bot commented Apr 8, 2024

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/58206/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@joyeecheung joyeecheung added the commit-queue PRs queued for automated landing through the Commit Queue. label Apr 8, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Apr 8, 2024
@nodejs-github-bot
nodejs-github-bot merged commit 45f0dd0 into nodejs:main Apr 8, 2024
@nodejs-github-bot

nodejs-github-bot commented Apr 8, 2024

Copy link
Copy Markdown
Collaborator

Landed in 45f0dd0

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@RafaelGSS RafaelGSS mentioned this pull request Apr 15, 2024
2024-04-24, Version 22.0.0 (Current) #52505
Merged
@karlhorky karlhorky mentioned this pull request Apr 28, 2024
Flattening feature creates lengthy folder structures pnpm/pnpm#6830
Closed
@karlhorky

karlhorky commented May 2, 2024

Copy link
Copy Markdown
Contributor

It looks like the Node.js v22 PR contains the fix "module,win: fix long path resolve (by @StefanStojanovic) #51097":

  • 2024-04-24, Version 22.0.0 (Current) #52505

So maybe Node.js has support for long paths on Windows now!

(make sure that you have LongPathsEnabled set to true on the Windows machine you test on)

hsjoberg reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced May 2, 2024
Long node_modules paths cannot be found on Windows when LongPathsEnabled enabled #50753
Closed
Upgrade to Node.js v22 karlhorky/node-js-max_path-windows-bug#1
Open
@marco-ippolito marco-ippolito added the backport-blocked-v20.x label May 21, 2024
@karlhorky karlhorky mentioned this pull request Sep 9, 2024
Remove Windows long path workaround upleveled/preflight#572
Merged
@joyeecheung joyeecheung mentioned this pull request Jan 23, 2025
[v20.x backport] src: move package_json_reader cache to c++ #56590
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@anonrig anonrig anonrig left review comments
@joyeecheung joyeecheung joyeecheung approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. fs Issues and PRs related to file-system APIs and the fs module. needs-ci PRs that need a full CI run.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Long node_modules paths cannot be found on Windows when LongPathsEnabled enabled

Uh oh!

There was an error while loading. Please reload this page.

8 participants

@StefanStojanovic @richardlau @joyeecheung @nodejs-github-bot @karlhorky @anonrig @aduh95 @marco-ippolito
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.