Skip to content
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

[7.2.0] Ensure output root is an absolute path even if $HOME or $XDG_CACHE_HOME are relative #21796

Merged
merged 3 commits into from
Mar 26, 2024

Conversation

bazel-io
Copy link
Member

The Bazel server pre-processes the output root via PathFragmentConverter,
which absolutizes paths and expands leading "~" as the home directory. This
can cause the server and the client to treat different directories as output
root, leading to a server crash.

Thus, the client must make the output root absolute. We already do so when
the output root derives from $TEST_TMPDIR (without tilde expansion) in
StartupOptions::StartupOptions. And we do so (with tilde expansion, for
legacy reasons) when the output root derives from the --output_user_root
startup flag passed to the client, see StartupOptions::ProcessArg.

We must do the same when the output root derives from $HOME or
$XDG_CACHE_HOME - without tilde expansion, since it's generally expected
that tools do not perform tilde expansion on paths derived from env
variables (and since tilde expansion on $HOME is meaningless and a
recursive explosion).

Fixes #21660

PiperOrigin-RevId: 615506594
Change-Id: Ice67c8be43cef2812b6dce591bd65b9813e82f5c

Commit f12fc13

…ME are relative

The Bazel server pre-processes the output root via PathFragmentConverter,
which absolutizes paths and expands leading "~" as the home directory. This
can cause the server and the client to treat different directories as output
root, leading to a server crash.

Thus, the client must make the output root absolute. We already do so when
the output root derives from $TEST_TMPDIR (without tilde expansion) in
StartupOptions::StartupOptions. And we do so (with tilde expansion, for
legacy reasons) when the output root derives from the --output_user_root
startup flag passed to the client, see StartupOptions::ProcessArg.

We must do the same when the output root derives from $HOME or
$XDG_CACHE_HOME - without tilde expansion, since it's generally expected
that tools do not perform tilde expansion on paths derived from env
variables (and since tilde expansion on $HOME is meaningless and a
recursive explosion).

Fixes bazelbuild#21660

PiperOrigin-RevId: 615506594
Change-Id: Ice67c8be43cef2812b6dce591bd65b9813e82f5c
@bazel-io bazel-io added team-Core Skyframe, bazel query, BEP, options parsing, bazelrc awaiting-review PR is awaiting review from an assigned reviewer labels Mar 25, 2024
@bazel-io bazel-io requested a review from a team as a code owner March 25, 2024 20:32
@iancha1992 iancha1992 requested a review from tetromino March 25, 2024 20:48
@iancha1992 iancha1992 enabled auto-merge (squash) March 26, 2024 17:11
@tetromino
Copy link
Contributor

tetromino commented Mar 26, 2024

This requires the fix for #21635 to be cherry-picked first - thus, blocked on #21817

@iancha1992 iancha1992 merged commit ddad8cb into bazelbuild:release-7.2.0 Mar 26, 2024
32 checks passed
@github-actions github-actions bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Core Skyframe, bazel query, BEP, options parsing, bazelrc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants