-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Allow longpath executables #22532
base: master
Are you sure you want to change the base?
Allow longpath executables #22532
Conversation
25bc69a
to
5879ac7
Compare
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.
All looks reasonable to me, thanks for the contribution!
Can you please add a test in https://cs.opensource.google/bazel/bazel/+/master:src/test/py/bazel/bazel_windows_test.py?
stem.remove_suffix(1); | ||
} | ||
|
||
std::wstring wrapper_file_name = std::wstring(stem) + L".wrapper.bat"; |
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 might be risk of conflict with existing file or lack of write permission? Can we find a safer place to create the wrapper?
Sure, will also try and fix the string view compilation failures ;.; |
We ran into #19710 when we started to tinker with the Python rules and bazel, as we were running into extremely long execution times when running anything related to Python (45-60s). Disabling Python zipping and enabling runfiles on windows brought the execution times down and made them comparable to MacOS/Linux, which was a huge win.
Only issue is that the runfiles then ran straight into the wonderful longpath problems from the linked issue when running tests that now used runfiles. If 8dot3 names are not turned on, or there is no short path associated with the given path, then the AsShortPath function will fail. Even though "Technically" long paths could be enabled and windows could actually still execute the requested executable.
Although CreateProcessW has the MAX_PATH limit built into it, which can never be worked around, batch files seemingly do not have this issue. So, we can simply dump the requested command line into a batch file and redirect the command line to run that batch file instead.
This is a similar approach to CMake/Ninja when a CustomCommand is over a certain (8192) character limit. In that situation they create a new batch file that has the command inside and ensure that the Ninja target just runs that file instead.