Skip to content

incompatible_windows_bashless_run_command: enables Bash-less "bazel run" on Windows #8240

Closed

Description

@laszlocsomor

Description

Related bug: #8229

The option --incompatible_windows_bashless_run_command enables Bash-less "bazel run" on Windows. This flag has NO effect on other platforms.

When disabled, bazel run //:foo_bin runs the binary through Bash, and fails with --shell_executable="". Bazel will:

  • escape and join the arguments with Bash escaping semantics
  • run the binary through Bash with bash -c <joined_args>

When enabled, bazel run //:foo_bin does not require Bash and works with --shell_executable="". Bazel runs the binary directly (instead of through bash -c), and escapes the arguments Windows-style (the same as enabled by #7454). But Bash is still required when using --run_under=foo or --script_path=<path>, even when --incompatible_windows_bashless_run_command is enabled.

Migration recipe

None, as of 2019-05-06.

We don't expect any breakages when this flag is enabled. However if it breaks your build, please let us know so we can help fixing it and provide a migration recipe.

Rollout plan

  • Bazel 0.26.0 will not support this flag.
  • Bazel 0.27.0 is expected to support this flag, with default value being false.
  • Bazel 0.28.0 is expected to support this flag, with default value being true.
  • Bazel 0.29.0 is expected to not support this flag.

Activity

  1. self-assigned this
    on May 6, 2019
  2. added
    incompatible-change
    P2
    on May 6, 2019
  3. changed the title [-]incompatible_bashless_run_command: enables Bash-less "bazel run" on Windows[/-] [+]incompatible_windows_bashless_run_command: enables Bash-less "bazel run" on Windows[/+] on May 8, 2019
  4. 1 remaining item

  5. laszlocsomor commented on Jul 3, 2019

    @laszlocsomor
    ContributorAuthor

    @keith : I'm curious, why does it seem so? The flag exists in 0.27.0 -- search for incompatible_windows_bashless_run_command in src/main/java/com/google/devtools/build/lib/runtime/commands/RunCommand.java inside of https://github.com/bazelbuild/bazel/releases/download/0.27.1/bazel-0.27.1-dist.zip.

  6. siddharthab commented on Jul 3, 2019

    @siddharthab
    Contributor

    This flag is only available with run and not with build, but bazelisk is not aware of the distinction between the different bazel commands, and will test all migration flags.

  7. laszlocsomor commented on Jul 3, 2019

    @laszlocsomor
    ContributorAuthor

    Aah, thanks!

  8. keith commented on Jul 3, 2019

    @keith
    Member
  9. laszlocsomor commented on Jul 9, 2019

    @laszlocsomor
    ContributorAuthor
  10. laszlocsomor commented on Aug 6, 2019

    @laszlocsomor
    ContributorAuthor
  11. laszlocsomor commented on Aug 6, 2019

    @laszlocsomor
    ContributorAuthor

    Update: the test breakage is legitimate. It indicates an escaping bug in Bazel. I have a bugfix in https://github.com/laszlocsomor/bazel/tree/fix-GOOD-bashless-run-caller-escapes that I need to clean up before sending out.

  12. drigz commented on Sep 23, 2019

    @drigz
    Contributor

    Does windows.md need updating? It says:

    With Bazel 0.25.0 you still need Bash (MSYS2) to bazel run //foo:bin anything. [...] Follow issue #8240 for updates.

  13. laszlocsomor commented on Sep 23, 2019

    @laszlocsomor
    ContributorAuthor

    Only after Bazel 1.0.0 came out -- it will flip --incompatible_windows_bashless_run_command to true by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2incompatible-changetype: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions