-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Ignore read-only errors when updating the mtime of the install_base
#20442
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
Ignore read-only errors when updating the mtime of the install_base
#20442
Conversation
src/main/cpp/blaze.cc
Outdated
| if (errno == EROFS || errno == EPERM) { raise_error = false; } | ||
| #elif defined(_WIN32) | ||
| // On Windows, `SetToNow` is backed by `CreateFileW` + `SetFileTime`: | ||
| if (::GetLastError() == ERROR_ACCESS_DENIED) { raise_error = false; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure whether this is correct; unfortunately I don't have access to a Windows machine at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI seems to confirm that this does at least build on Windows.
tjgq
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We try to keep the platform-dependent filesystem code in file_platform.h and its two implementations, file_posix.cc and file_windows.cc.
How about adding a new SetToNowIfPossible method there with the desired "permissions error counts as success" semantics?
Currently if the `--install_base` path passed is not writable by the user invoking Bazel, the Bazel client crashes[^1]: ```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 [^1]: Note that if you invoke Bazel again after this happens, it will successfully start up because the `install` symlink in the output base [that inhibits the `mtime` update/install base check] has already been [created]. [that inhibits the `mtime` update/install base check]: https://github.com/bazelbuild/bazel/blob/a3c677dfea2de636a719d50345a5a97af96fae60/src/main/cpp/blaze.cc#L983-L993 [created]: https://github.com/bazelbuild/bazel/blob/a3c677dfea2de636a719d50345a5a97af96fae60/src/main/cpp/blaze.cc#L1003 This commit updates the client to ignore such errors. See bazelbuild#20373 for context.
ed3d573 to
da0afbb
Compare
@tjgq done; PTAL. |
|
@bazel-io flag |
|
@bazel-io fork 7.1.0 |
|
@brentleyjones please let me know if you want this included with 6.5.0 as well. |
|
@iancha1992 If it applies nicely, it would be good to get in, yes. |
|
@bazel-io fork 6.5.0 |
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
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
…tall_base` (#20568) 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 #20373 for context. Closes #20442. Commit 7f782e3 PiperOrigin-RevId: 591266054 Change-Id: If53e7cad48cb62406f7883f72b413e4b5a0bb8e2 Co-authored-by: Rahul Butani <[email protected]> Co-authored-by: Ian (Hee) Cha <[email protected]>
…tall_base` (#20648) 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 #20373 for context. Closes #20442. Commit 7f782e3 PiperOrigin-RevId: 591266054 Change-Id: If53e7cad48cb62406f7883f72b413e4b5a0bb8e2 Co-authored-by: Rahul Butani <[email protected]> Co-authored-by: Ian (Hee) Cha <[email protected]>
|
The changes in this PR have been included in Bazel 6.5.0 RC1. Please test out the release candidate and report any issues as soon as possible. If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=last_rc. |
|
The changes in this PR have been included in Bazel 7.1.0 RC1. Please test out the release candidate and report any issues as soon as possible. If you're using Bazelisk, you can point to the latest RC by setting USE_BAZEL_VERSION=last_rc. |
Note
Follow-up to #20373 (see here)
Currently if the
--install_basepath passed is not writable by the user invoking Bazel, the Bazel client crashes:This happens because the Bazel client (unconditionally) attempts to update the
mtimeof this path:bazel/src/main/cpp/blaze.cc
Lines 1010 to 1021 in a3c677d
This commit updates the client to ignore such errors. See #20373 for context.
cc: @tjgq