Open
Description
G'day,
Rules_go does a good job a making the environment hermetic, by carefully defining which environment variables make it to the sandbox.
However, "GODEBUG='winsymlink=0'" should only be set for Windoze builds.
The bug is on this line, which always includes this option.
https://github.com/bazel-contrib/rules_go/blob/master/go/private/context.bzl#L552
Probably this option should only be included when "mode.goos" == Windoze
Run this command to start an interactive shell in an identical sandboxed environment:
(exec env - \
CC=external/toolchains_llvm++llvm+llvm_toolchain/bin/cc_wrapper.sh \
CGO_ENABLED=1 \
GOARCH=amd64 \
GODEBUG='winsymlink=0' \ <----- should only be set on windoze
GOEXPERIMENT=nocoverageredesign \
GOOS=linux \
GOPATH='' \
GOROOT=bazel-out/k8-fastbuild/bin/external/rules_go+/stdlib_ \
GOROOT_FINAL=GOROOT \
GOTOOLCHAIN=local \
PATH=external/toolchains_llvm++llvm+llvm_toolchain/bin:/bin:/usr/bin \
TMPDIR=/tmp \
ZERO_AR_DATE=1 \
/home/das/.cache/bazel/_bazel_das/install/254cc618fc52f01b2b1d5fd6ff343774/linux-sandbox -t 15 -w /dev/shm -w /home/das/.cache/bazel/_bazel_das/2069c7e7bbea1cec17d73a6b1498e560/sandbox/linux-sandbox/13/execroot/_main -w /tmp -M /home/das/.cache/bazel/_bazel_das/2069c7e7bbea1cec17d73a6b1498e560/sandbox/linux-sandbox/13/_hermetic_tmp -m /tmp -S /home/das/.cache/bazel/_bazel_das/2069c7e7bbea1cec17d73a6b1498e560/sandbox/linux-sandbox/13/stats.out -D /home/das/.cache/bazel/_bazel_das/2069c7e7bbea1cec17d73a6b1498e560/sandbox/linux-sandbox/13/debug.out -- /bin/sh -i)
ERROR: /home/das/Downloads/go_hello_world_race/BUILD.bazel:24:11: GoCompilePkg hello_lib.a failed: (Exit 1): linux-sandbox failed: error executing GoCompilePkg command
(cd /home/das/.cache/bazel/_bazel_das/2069c7e7bbea1cec17d73a6b1498e560/sandbox/linux-sandbox/13/execroot/_main && \
exec env - \
CC=external/toolchains_llvm++llvm+llvm_toolchain/bin/cc_wrapper.sh \
CGO_ENABLED=1 \
GOARCH=amd64 \
GODEBUG='winsymlink=0' \ <---- :(
GOEXPERIMENT=nocoverageredesign \
GOOS=linux \
GOPATH='' \
GOROOT=bazel-out/k8-fastbuild/bin/external/rules_go+/stdlib_ \
GOROOT_FINAL=GOROOT \
GOTOOLCHAIN=local \
PATH=external/toolchains_llvm++llvm+llvm_toolchain/bin:/bin:/usr/bin \
TMPDIR=/tmp \
ZERO_AR_DATE=1 \
/home/das/.cache/bazel/_bazel_das/install/254cc618fc52f01b2b1d5fd6ff343774/linux-sandbox -t 15 -w /dev/shm -w
I think this bug was introduced by #4050 when trying to resolve
#4049
You can definitely argue this doesn't matter because it's ignored on non-Windoze, however I bet you would reject an PR if somebody wanted to set "FOO=BAR", because it would be unnecessarily cluttering the environment variable space.
Thanks,
Dave
Metadata
Metadata
Assignees
Labels
No labels