Repository navigation
Description
Description of the problem / feature request:
When BAZEL_SH envvar is not defined and Bazel searches for a suitable bash.exe, it should not look for Git Bash nor should it recommend installing it as a Bash implementation.
Git Bash does not support the full set of bintools that MSYS2 Bash does, nor does Git Bash support Pacman to install those tools. Git Bash is therefore unsuitable as a general-purpose Bash for Windows.
Even worse, if you have both Git Bash and MSYS Bash installed, they may collide if you run one's binaries from the other (see repro below).
Bazel should only look for MSYS2 Bash and recommend only that.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
-
Have both Git Bash and MSYS2 Bash installed, have paths to them that have no space characters:
C:\src\tmp>mklink /j C:\git "C:\Program Files\Git" Junction created for C:\git <<===>> C:\Program Files\Git -
In MSYS2 Bash install "zip" by running
pacman -Syu zip. -
Set "BAZEL_SH" envvar to point to Git Bash, put Git then MSYS on the PATH:
BAZEL_SH=C:\git\usr\bin\bash.exe PATH=C:\git\usr\bin;C:\msys64\usr\bin -
Build a genrule that runs
zip.C:\src\tmp>type BUILD genrule( name = "foo", outs = ["foo.txt"], cmd = ("echo \"DEBUG: $$(cygpath -w $$(which bash))\" ; " + "echo \"DEBUG: $$(cygpath -w $$(which zip))\" ; " + "zip > $@") ) C:\src\tmp>c:\src\bazel-releases\0.16.0\bazel.exe build --verbose_failures //:foo.txt INFO: Analysed target //:foo.txt (0 packages loaded). INFO: Found 1 target... SUBCOMMAND: # //:foo [action 'Executing genrule //:foo'] cd C:/users/laszlocsomor/_bazel_laszlocsomor/zovul4l7/execroot/__main__ SET PATH=C:\git\usr\bin;C:\git\bin;C:\git\usr\bin;C:\msys64\usr\bin C:/git/usr/bin/bash.exe -c source external/bazel_tools/tools/genrule/genrule-setup.sh; echo "DEBUG: $(cygpath -w $(which bash))" ; echo "DEBUG: $(cygpath -w $(which zip))" ; zip > bazel-out/x64_windows-fastbuild/genfiles/foo.txt ERROR: C:/src/tmp/BUILD:107:1: Executing genrule //:foo failed (Exit 127): bash.exe failed: error executing command cd C:/users/laszlocsomor/_bazel_laszlocsomor/zovul4l7/execroot/__main__ SET PATH=C:\git\usr\bin;C:\git\bin;C:\git\usr\bin;C:\msys64\usr\bin C:/git/usr/bin/bash.exe -c source external/bazel_tools/tools/genrule/genrule-setup.sh; echo "DEBUG: $(cygpath -w $(which bash))" ; echo "DEBUG: $(cygpath -w $(which zip))" ; zip > bazel-out/x64_windows-fastbuild/genfiles/foo.txt DEBUG: C:\git\usr\bin\bash.exe DEBUG: C:\msys64\usr\bin\zip.exe 1 [main] zip (6740) C:\msys64\usr\bin\zip.exe: *** fatal error - cygheap base mismatch detected - 0x180318410/0x1802FF410. This problem is probably due to using incompatible versions of the cygwin DLL. Search for cygwin1.dll using the Windows Start->Find/Search facility and delete all but the most recent version. The most recent version *should* reside in x:\cygwin\bin, where 'x' is the drive on which you have installed the cygwin distribution. Rebooting is also suggested if you are unable to find another cygwin DLL. Target //:foo.txt failed to build INFO: Elapsed time: 1.160s, Critical Path: 0.70s INFO: 0 processes. FAILED: Build did NOT complete successfully
What operating system are you running Bazel on?
Windows 10
What's the output of bazel info release?
C:\src\tmp>c:\src\bazel-releases\0.16.0\bazel.exe info release
release 0.16.0
Activity
Windows: do not look for Git Bash
Windows: do not look for Git Bash
Windows: do not look for Git Bash
Release 0.17.1 (2018-09-14)
Release 0.17.1 (2018-09-14)