Skip to content

Bazel doesn't respect XDG_CACHE_HOME #16937

@ebyrne242

Description

@ebyrne242

Description of the bug:

Bazel writes caches, often many megabytes in size to $USER/.cache/bazel on Linux. It's common for users on NFS home dirs to set the XDG_CACHE_HOME environment variable to put their caches on a local disk instead. However, bazel ignores this variable and continues to write to ~/.cache/bazel.

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

export XDG_CACHE_HOME=/tmp/$USER/bazel

build anything with bazel

bazel still writes output to ~/.cache/bazel

Which operating system are you running Bazel on?

CentOS 7.9

What is the output of bazel info release?

No response

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

$ bazel info release

WARNING: Output base '/data/homes/nfs/home/user/.cache/bazel/_bazel_user/33181acb49c359f0b2bfbb3335eecb1f' is on NFS. This may lead to surprising failures and undetermined behavior.

release 5.3.2

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?

Suggestions that TEST_TMPDIR is the only way to influence the output dir, along with suggestions it should not be used.

Any other information, logs, or outputs that you want to share?

No response

Metadata

Metadata

Assignees

Labels

P2We'll consider working on this in future. (Assignee optional)area-EngProdBazel CI, infrastructure, bootstrapping, release, and distribution toolingteam-OSSIssues for the Bazel OSS team: installation, release processBazel packaging, websitetype: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions