-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Apply genrule-setup.sh to Starlark shell actions #13078
Comments
Comments copied from pre-markdown version:
Also:
|
Can you take the bit of functionality you are working towards and make it apply in a sh-less environment on Windows? Perhaps failfast is a setting on the genrule (with a default in the global workspace config). The executor then can add the right flags for bash or cmd.exe. |
It seems that we do assume the shell is Bash or Bash-compatible, so hopefully
If we make the existing shell strict, that'll affect all genrules and Starlark shell actions (and maybe other things too). If we add an alternative shell tool, and allow genrules and Starlark shell actions to choose the tool via an attribute/param, then we still are making Bazel know about shell strictness, so we may as well implement it using a single underlying tool. If we do an incompatible change to make all Starlark shell actions use the strict tool, then maybe you can argue it's cleaner to not have SkylarkActionFactory know about
Is Windows now, or will it be, sh-less? If so, what are genrule and run_shell() going to do? |
Separate from how we factor strictness between run_shell() and the toolchain, there's the issue of whether or not expanding the hook for customizing shell initialization is the Right Thing To Do. Maybe we don't want to let repo owners declare arbitrary custom semantics for run_shell() -- i.e., maybe genrules-setup.sh was a mistake. We could still get sandboxing support for remote execution platforms without genrule-setup.sh, by having those platforms provide their own shell toolchain, which would be selected in place of the default. |
also, cc @philwo |
The plan on Windows is to make Bazel sh-less. For genrule, people can choose to use bash, cmd or even powershell. How complicated is Currently, genrule and run_shell on Windows still require bash, so |
I suppose we'll have to do the same for
Currently it just makes shells strict via But we may be able to get away with not using this file at all. For strictness, as an alternative to sourcing the file, we can instead bake the |
If we want to make Bazel sh-less on Windows, I question the value of Is it possible to write a function like |
That seems appropriate and necessary if shell as a builtin concept is disappearing. +@tomlu for thoughts on reducing |
Adding to @laurentlb 's comment:
|
I don't think I'm going to pursue this at the moment, but the doc's there if someone else wants to pick it up. I think the main issues are:
|
Out of curiosity, why does
Is the same as:
|
The notion is that genrule-setup can apply workspace-wide common definitions, sandboxing, and (for builds with only one execution platform) execution environment setup. The counterargument is that these features do not belong in a workspace-scoped file that alters the semantics of all genrule / run_shell actions. |
@brandjon What is the status of this? |
The status is that I've pretty much forgotten everything not written down in this thread or the design doc. Since this issue clearly doesn't affect the core interpreter, we should probably Transfer it to the bazelbuild/bazel repository (and mark it P4). |
Hey guys! Just ran into some tricky error cases with this that makes me think it might be worth something a little higher than a P4. One can get some fairly weird behavior without Anyway, seems fairly worthwhile to add [Edit/side note btw, also might be worth defaulting --shell_executable to bash to be resolved via the PATH, at least on macOS? System Bash is from '07, so most people replace it with something newer. I think that'd do more what the user expects in more cases.] |
This is a proposal to have the custom initialization hook for genrules also apply to Starlark shell actions.
Initial PR for draft.
The text was updated successfully, but these errors were encountered: