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

[6.5.0] Ignore read-only errors when updating the mtime of the install_base #20568

Merged
merged 2 commits into from Jan 9, 2024

Conversation

bazel-io
Copy link
Member

Currently if the --install_base path passed is not writable by the user invoking Bazel, the Bazel client crashes:

bazel --install_base=/some/read/only/path version
FATAL: failed to set timestamp on '/some/read/only/path': (error: 30): Read-only file system

This happens because the Bazel client (unconditionally) attempts to update the mtime of this path:

bazel/src/main/cpp/blaze.cc

Lines 1010 to 1021 in a3c677d

// Update the mtime of the install base so that cleanup tools can
// find install bases that haven't been used for a long time
std::unique_ptr<blaze_util::IFileMtime> mtime(
blaze_util::CreateFileMtime());
if (!mtime->SetToNow(blaze_util::Path(startup_options.install_base))) {
string err = GetLastErrorString();
BAZEL_DIE(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR)
<< "failed to set timestamp on '" << startup_options.install_base
<< "': " << err;
}
}
}

This commit updates the client to ignore such errors. See #20373 for context.

Closes #20442.

Commit 7f782e3

PiperOrigin-RevId: 591266054
Change-Id: If53e7cad48cb62406f7883f72b413e4b5a0bb8e2

Currently if the `--install_base` path passed is not writable by the user invoking Bazel, the Bazel client crashes:
```console
❯ bazel --install_base=/some/read/only/path version
FATAL: failed to set timestamp on '/some/read/only/path': (error: 30): Read-only file system
```

This happens because the Bazel client (unconditionally) attempts to update the `mtime` of this path:
https://github.com/bazelbuild/bazel/blob/a3c677dfea2de636a719d50345a5a97af96fae60/src/main/cpp/blaze.cc#L1010-L1021

This commit updates the client to ignore such errors. See bazelbuild#20373 for context.

Closes bazelbuild#20442.

PiperOrigin-RevId: 591266054
Change-Id: If53e7cad48cb62406f7883f72b413e4b5a0bb8e2
@bazel-io bazel-io requested a review from a team as a code owner December 15, 2023 19:17
@bazel-io bazel-io added team-Rules-CPP Issues for C++ rules awaiting-review PR is awaiting review from an assigned reviewer labels Dec 15, 2023
@bazel-io bazel-io requested a review from tjgq December 15, 2023 19:17
@iancha1992
Copy link
Member

As per: #20442 (comment)

cc: @brentleyjones

@comius comius added team-CLI Console UI and removed team-Rules-CPP Issues for C++ rules labels Dec 28, 2023
@iancha1992 iancha1992 added this pull request to the merge queue Jan 8, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 8, 2024
@Wyverald Wyverald added this pull request to the merge queue Jan 9, 2024
Merged via the queue into bazelbuild:release-6.5.0 with commit 35efa96 Jan 9, 2024
24 checks passed
iancha1992 pushed a commit that referenced this pull request Jan 23, 2024
Baseline:  50b61e3

Release Notes:

+ Fix tree file materialized as symlink to another file when building without the bytes. (#20409)
+ Don't pass --add-opens= to javac (#20472)
+ Flip --incompatible_visibility_private_attributes_at_definition (#20520)
+ Fix extraction of tar archives containing sparse files. (#20531)
+ RemoteSpawnRunner: record inbetween phases in timing profile (#20550)
+ Add profiling to `remoteActionBuildingSemaphore.acquire()` (#20549)
+ The label API shakeup & docs cleanup (#20590)
+ Disable rewriter test (#20758)
+ Disable PyTest.testSmoke on macOS (#20729)
+ Upgrade abseil-cpp to fix build on macos_arm64 (#20785)
+ Ignore read-only errors when updating the `mtime` of the `install_base` (#20568)
+ Restart at most once when prepopulating repository rule environment (#20667)
+ Fix bootstrapped Bazel binary (#20804)
+ Add flag `experimental_throttle_remote_action_building` (#20861)
+ Fix versioned shared libraries for macOS toolchain (#20847)
+ Proto toolchainisation cherrypicks (#20925)

Acknowledgements:

This release contains contributions from many people at Google, as well as bazel.build machine account, Brentley Jones, Fabian Meumertzheim, Jordan Mele, Mai Hussien, oquenchil, Rahul Butani, Son Luong Ngoc, Xùdōng Yáng.
copybara-service bot pushed a commit that referenced this pull request Jan 23, 2024
Baseline:  50b61e3

Release Notes:

+ Fix tree file materialized as symlink to another file when building without the bytes. (#20409)
+ Don't pass --add-opens= to javac (#20472)
+ Flip --incompatible_visibility_private_attributes_at_definition (#20520)
+ Fix extraction of tar archives containing sparse files. (#20531)
+ RemoteSpawnRunner: record inbetween phases in timing profile (#20550)
+ Add profiling to `remoteActionBuildingSemaphore.acquire()` (#20549)
+ The label API shakeup & docs cleanup (#20590)
+ Disable rewriter test (#20758)
+ Disable PyTest.testSmoke on macOS (#20729)
+ Upgrade abseil-cpp to fix build on macos_arm64 (#20785)
+ Ignore read-only errors when updating the `mtime` of the `install_base` (#20568)
+ Restart at most once when prepopulating repository rule environment (#20667)
+ Fix bootstrapped Bazel binary (#20804)
+ Add flag `experimental_throttle_remote_action_building` (#20861)
+ Fix versioned shared libraries for macOS toolchain (#20847)
+ Proto toolchainisation cherrypicks (#20925)

Acknowledgements:

This release contains contributions from many people at Google, as well as bazel.build machine account, Brentley Jones, Fabian Meumertzheim, Jordan Mele, Mai Hussien, oquenchil, Rahul Butani, Son Luong Ngoc, Xùdōng Yáng.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-review PR is awaiting review from an assigned reviewer team-CLI Console UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants