-
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
bazel run should not inherit RUNFILES_DIR from OS #17571
Comments
The list of variables potentially affecting runfiles libraries further includes @meteorcloudy @Wyverald What do you think, could |
In general, I think it makes sense, but I wonder under what circumstances, users would set those env vars before running |
I'll defer to @linzhp for the first question. Running a binary directly already has some notable differences from running it via |
This is just a way to reproduce the issue. In the real scenario, they set
|
I see, thanks for the context! I'm happy to review a PR to address this issue ;) |
When an environment variable such as `RUNFILES_DIR` is set in the client environment when a target using runfiles libraries is run via `bazel run`, the libraries can't look up the runfiles directory or manifest. This is fixed by clearing the runfiles-related environment variables from the env in which the target is executed. Fixes bazelbuild#17571 Closes bazelbuild#17690. PiperOrigin-RevId: 516474822 Change-Id: Ia5201d4334b286b36ba2e476e850b98992ca0ffa
When an environment variable such as `RUNFILES_DIR` is set in the client environment when a target using runfiles libraries is run via `bazel run`, the libraries can't look up the runfiles directory or manifest. This is fixed by clearing the runfiles-related environment variables from the env in which the target is executed. Fixes bazelbuild#17571 Closes bazelbuild#17690. PiperOrigin-RevId: 516474822 Change-Id: Ia5201d4334b286b36ba2e476e850b98992ca0ffa
When an environment variable such as `RUNFILES_DIR` is set in the client environment when a target using runfiles libraries is run via `bazel run`, the libraries can't look up the runfiles directory or manifest. This is fixed by clearing the runfiles-related environment variables from the env in which the target is executed. Fixes #17571 Closes #17690. PiperOrigin-RevId: 516474822 Change-Id: Ia5201d4334b286b36ba2e476e850b98992ca0ffa Closes #19596
A fix for this issue has been included in Bazel 6.4.0 RC2. Please test out the release candidate and report any issues as soon as possible. Thanks! |
Description of the bug:
Runfile libraries such as github.com/bazelbuild/rules_go/go/runfiles relies on the environment variables
RUNFILES_DIR
andRUNFILES_MANIFEST_FILE
to work correctly. These two variables are set by Bazel duringbazel run
. However, if they are set in OS, Bazel would inherit them and not set them anymore, leading to machine dependent behaviors.What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
It outputs
/tmp/go_sdk/bin/gofmt
, but Bazel should ignoreRUNFILES_DIR=/tmp
, and output something like/private/var/tmp/_bazel_zplin/a20570cf42c983bd18597126a6b3c06e/external/go_sdk/bin/gofmt
instead.Which operating system are you running Bazel on?
macOS
What is the output of
bazel info release
?release 6.0.0-homebrew
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: