-
Notifications
You must be signed in to change notification settings - Fork 30k
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
module,win: fix long path resolve #53294
module,win: fix long path resolve #53294
Conversation
@nodejs/platform-windows |
3ee742c
to
27a4505
Compare
I actually need more time to take a look, I think the implementation will solve the problem but I want to test in which cases we should include the UNC path, since we didn't do this in all paths in the toNamespacedPath.
There are some conditions to include the Lines 632 to 645 in 58711c2
Although the condition could be matched, I think it would be better to wait for the migration of Maybe we could include the @anonrig What do you think? |
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.
I prefer to land this after the toNamespacedPath migration to C++. Unfortunately, I don't have the time to pursue this at the moment (afaict, there is only one failing test). I appreciate if you could took over that PR and apply these changes in a follow up PR.
in that case, can you convert the blocking "request changes" into a simple suggestion/friendly ask? I don't think this PR should be blocked on a PR that is not being currently worked on |
Sure, no problem, I'll take over your PR and start working on it. |
27a4505
to
42b88bf
Compare
42b88bf
to
14a1de0
Compare
@anonrig I've rebased this PR to use toNamespacedPath. Could you please review it? |
Is there anything else I can do to help this PR move forward? |
src/node_file.cc
Outdated
switch (FilePathIsFile(env, file_path)) { | ||
Local<Value> local_file_path = | ||
Buffer::Copy( | ||
env->isolate(), file_path.c_str(), strlen(file_path.c_str())) |
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.
env->isolate(), file_path.c_str(), strlen(file_path.c_str())) | |
env->isolate(), file_path.c_str(), file_path.size()) |
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.
Fixed. Thanks.
src/node_file.cc
Outdated
switch (FilePathIsFile(env, file_path)) { | ||
Local<Value> local_file_path = | ||
Buffer::Copy( | ||
env->isolate(), file_path.c_str(), strlen(file_path.c_str())) |
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.
ditto
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.
Fixed.
src/node_modules.cc
Outdated
// Check if the path has a trailing slash. If so, add it after | ||
// ToNamespacedPath() as it will be deleted by ToNamespacedPath() | ||
bool slashCheck = !path_value.ToString().empty() && | ||
path_value.ToString().back() == |
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.
path_value.ToString().back() == | |
path_value.ToStringView().ends_with |
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.
Fixed.
src/node_modules.cc
Outdated
// Check if the path has a trailing slash. If so, add it after | ||
// ToNamespacedPath() as it will be deleted by ToNamespacedPath() | ||
bool slashCheck = !path_value.ToString().empty() && | ||
path_value.ToString().back() == |
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.
ditto
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.
Fixed.
src/node_modules.cc
Outdated
@@ -323,8 +323,8 @@ void BindingData::GetNearestParentPackageJSON( | |||
// Check if the path has a trailing slash. If so, add it after | |||
// ToNamespacedPath() as it will be deleted by ToNamespacedPath() | |||
bool slashCheck = !path_value.ToString().empty() && | |||
path_value.ToString().back() == | |||
std::filesystem::path::preferred_separator; | |||
path_value.ToStringView().ends_with( |
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.
The previous line is not needed path_value.ToString()
creates an unnecessary string.
Can you also remove this in other places?
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.
Fixed.
I've fixed the suggestions. Is there anything else I can do to help this PR move forward? |
@anonrig Is there anything else we can do to help this PR move forward? I'm having many issues with long paths on Windows and am eager to get this fixed. |
The failing test in the CI is a known flaky test. |
Landed in 37f9eca |
PR-URL: #53294 Fixes: #50753 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
PR-URL: #53294 Fixes: #50753 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Vinícius Lourenço Claro Cardoso <[email protected]>
Several issues were encountered with module loading due to extended path lengths on Windows. These have been addressed with corrections implemented across four distinct code locations, accompanied by the addition of a corresponding test case for each to ensure functionality.
Additionally, I've moved
es-module/test-GH-50753.js
toes-module/test-esm-long-path-win.js
as the tests cover more cases than specified in that issue.Fixes: #50753