-
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
native.sh_binary converts binary arguments starting with / #6764
Comments
Thanks for the report! Do you see any problem with |
@laszlocsomor prepending But that puts the onus on Bazel developers to be aware of an implementation detail (usage of MSYS on Windows platforms) inside of Bazel. I'm not sure how many are aware of this caveat. Are there any cases where the path conversion is desirable? Perhaps the flag could be set by Bazel when invoking MSYS. Off the top of my head:
|
Sorry for the long delay. This is a difficult question. Inside the shell script, it should be fine to use Unix paths like Disabling path conversion means those paths will be passed to binaries unchanged. That's often not what you want. Demo: Even inside of a script and even within one command, you may want to mix paths ( Bazel cannot make a right choice here. The onus is indeed on the user. (Is that what you meant? You wrote "on Bazel developers".) WDYT? |
Here's an even better demo: https://github.com/laszlocsomor/projects/tree/c3caa558c7fe59388df734b9f59baac92dae86fe/bazel/msys-path-conv (added to previous comment) |
Well there are three types of developers, so it is worth to clarify:
When I said "But that puts the onus on Bazel developers to be aware of an implementation detail" I should have clarified. I meant the t2 developers, that have to understand that Bazel uses MSYS2 on windows and safeguard their code against path conversion where applicable. If in the future MSYS2 is no longer used, t2 developers would to remove MSYS2 logic from their rules. I won't do anything if it stays there but it's essentially dead code. If t2 developers properly safeguard their rules, t3 developers won't have to care about MSYS2. But if they don't, path conversion can give rise to odd bugs. I think it's accurate that t1 developers cannot make the choice to blanket disable path conversion logic, given the myriad use cases. Perhaps it is a matter of documentation for t2 developers on how to properly support Windows. I'm not aware of a definite resource for this topic right now, but if I had to choose a few topics they would be:
|
Thanks for the clarification! I see no way to relieve t2 developers from having to know about Bazel's use of MSYS2 and about MSYS2's quirks in particular. I agree documentation could help explaining this so t2 developers don't have to reinvent the wheel and learn about these quirks every time. Where do you think such documentation should live so it's easily discoverable? (Where would you look for it?) Thanks for the topics! That's a great set of Qs for a FAQ. |
I would look for it in https://bazel.build/ -> I'd expect to find a small tutorial on how to make my own language rule and how to ensure windows compatibility, and some resources for further reading. |
Thanks! I think #3889 is the most relevant bug. |
This issue looks resolved by #3889 |
Description of the problem / feature request:
When using Bazel under Windows and using
native.sh_binary
with a script that invokes a binary, arguments starting with/
will be converted to paths according to Posix_path_conversion.This becomes a problem when constructing scripts that need to take user input for which this format might be relevant, such as specifying a serving path for a http server (bazelbuild/rules_typescript#327 (comment)).
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Have a script that invokes a binary, providing it with an argument starting with
/
.I used
node
as the binary because I had it in my system and this didn't seem to manifest with built-ins likeecho
.Below is a repository with this code.
You should see
What operating system are you running Bazel on?
Windows 10 1803.
What's the output of
bazel info release
?0.19.2
.Have you found anything relevant by searching the web?
No.
Any other information, logs, or outputs that you want to share?
Path conversion behaviour in MSYS can be disabled using
MSYS2_ARG_CONV_EXCL="*"
(msys2/MSYS2-packages#84 (comment)).Related to #3001, #5966.
The text was updated successfully, but these errors were encountered: