-
Notifications
You must be signed in to change notification settings - Fork 69
Description
We noticed that an unexpected new output_user_root
directory was being created (at the default location, which is a function of $USER) when calling generate-hashes
with --bazelStartupOptions
that explicitly specified an output user root directory.
After some investigation, it appears that this is due to the bazel info output_base
call in the hasherModule function here. This particular Bazel invocation does not pass any startup options, although the function has direct access to them. By ignoring these startup options, this call creates a new output_user_root. Subsequent Bazel query invocations do seem to properly pass all startup options.
A call like the following can be used to reproduce the issue:
bazel-diff generate-hashes \
<output-json-file-path> \
--workspacePath=<workspace-path> \
--bazelStartupOptions=--output_user_root=/tmp/output_user_root --output_base=/tmp/output_base
After invoking the above, you should notice two new output_user_root directories:
- One created under
/home/$USER/.cache/bazel/_bazel_$USER
- this occurs due to thebazel info output_base
call that does not properly pass startup options. - One created at the desired
/tmp/output_user_root
- this occurs due to subsequent query invocations that do properly pass startup options.
The ask here is to fix this bazel info output_base
invocation, and any others (although other offending calls have not been identified) that do not pass the startup options, to properly respect the user supplied startup options. A fix can be verified by verifying that the example command above does not create the unexpected output_user_root in /home/$USER/.cache/bazel