-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
build: add long paths awareness on windows #44522
Conversation
Libuv has a manifest file to enable working with long paths. Node does not have that in its manifest and that leads to problems in some cases on Windows (eg. realpath.native). Windows long path test is also improved to cover the mentioned issue. Fixes: nodejs#39721
@StefanStojanovic It seems the test failure is related to your change. Please take a look. |
Yes, tests failed because of my change. The problem with it is that manifest file long path awareness relies on registry key |
Does it make sense to land both this and #44536? |
I wonder if it is better to use a single commit to facilitate backporting without breaking tests. |
Ok. |
Superseded by #44536. |
@StefanStojanovic I guess we can close this one as #44536 landed? |
Yes |
On windows when using
fs.realpath.native
,fs.realpathSync.native
andfs.promises.realpath
on long path, ENOENT is thrown. On the other hand, long paths work well withfs.realpath
andfs.realpathSync
. On Linux, all of the mentionedrealpath
versions work as expected.The problem with native realpath implementation on windows was, that by default applications aren't long path aware, unless specified otherwise by their manifest file, which was the case with node. The other way to enable working with long paths is to add a
\\?\
prefix to path prior to using it in windows API functions. This approach is used by allfs
functions working with paths (they add prefix by callingpathModule.toNamespacedPath(path)
), but this is not done infs.realpath.native
andfs.realpathSync.native
.Although fix could have been made in
fs.js
, a change to node manifest file was chosen as a more comprehensive and broader solution to the long paths on windows problem in general.An existing windows long path test is improved to cover the issue that is fixed by these changes.
Fixes: #39721