-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Parent directory of output file not made writable when building without the bytes #23462
Comments
Debugging note: it's not a sandboxing issue, an error also occurs with |
--remote_download_toplevel
…ilding without the bytes. Fixes bazelbuild#23462.
…ilding without the bytes. Fixes bazelbuild#23462.
…ilding without the bytes. Fixes bazelbuild#23462. Closes bazelbuild#23555. PiperOrigin-RevId: 672863567 Change-Id: I50af46f2ae637fb478e81ae31bd16ac4e306fe40
This looks to be the same issue that spurred the creation of #23283. Had this issue crop up internally today and repro'd with the logging improvements in #23381.
With some more digging; _bzl_out="/_monorepo_/execroot/_main/bazel-out/darwin_arm64-fastbuild/bin"
echo "Checking ${_bzl_out}"
ls -l "${_bzl_out}"
# All fine
echo "Checking ${_bzl_out}/tools"
ls -l "${_bzl_out}/tools"
# All fine
echo "Checking ${_bzl_out}/tools/logging"
ls -l "${_bzl_out}/tools/logging"
# dist/ missing writable permission, node_modules/ (a bazel output via Rules JS) also shown for comparison
# dr-xr-xr-x 2 _user_ _group_ 64 15 Aug 16:00 dist
# drwxr-xr-x 5 _user_ _group_ 160 10 Sep 11:29 node_modules
echo "Checking ${_bzl_out}/tools/logging/dist"
ls -l "${_bzl_out}/tools/logging/dist"
# Empty (as expected)
echo "Checking ${_bzl_out}/tools/logging/dist/logger.js"
ls -l "${_bzl_out}/tools/logging/dist/logger.js"
# Missing (as expected)
The fix (backported for 7.4.0 via #23577) likely will solve this issue 🤞. |
… when building without the bytes. (#23577) Fixes #23462. Closes #23555. PiperOrigin-RevId: 672863567 Change-Id: I50af46f2ae637fb478e81ae31bd16ac4e306fe40 Commit 885a6ba Co-authored-by: Tiago Quelhas <[email protected]>
Had the issue manifest again and confirmed the backport worked. |
A fix for this issue has been included in Bazel 7.4.0 RC1. Please test out the release candidate and report any issues as soon as possible. |
- Enable BwoB on Windows again now that bazelbuild/bazel#23462 has been fixed.
- Enable BwoB on Windows again now that bazelbuild/bazel#23462 has been fixed.
- Enable BwoB on Windows again now that bazelbuild/bazel#23462 has been fixed.
Description of the bug:
This is the same as #13229, except it seems to have resurfaced with
--remote_download_toplevel
(or--remote_download_minimal
) enabled. Since--remote_download_toplevel
enabled by default in bazel 7.x+, it occurs in the default configuration of bazel 7.x+ if remote cache is enabled.To summarize, if I have an action that creates a directory artifact, and then I replace it with a different action that creates a file in the directory, that action will fail because bazel fails to add write permissions to the directory. I can work around this with
bazel clean
, but that is prohibitively expensive for large repos.The error looks like:
The original issue was supposed to be fixed in cff2ea5, but it seems like that logic isn't being used when
--remote_download_toplevel
is enabled.Which category does this issue belong to?
Local Execution
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Create the workspace from this gist: https://gist.github.com/william-smith-skydio/654bfe393e9388bb11c2c2f32f60628c
Run:
This will succeed. Now change
use_dir
toFalse
for thefoobar
rule and re-run:This fails:
The output directory has these permissions (the directory is missing write permissions):
Which operating system are you running Bazel on?
Ubuntu 18.04
What is the output of
bazel info release
?7.3.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?No response
If this is a regression, please try to identify the Bazel commit where the bug was introduced with bazelisk --bisect.
No response
Have you found anything relevant by searching the web?
Other potentially-related issues:
Could not move output artifacts from sandboxed execution
is not given #23283Any other information, logs, or outputs that you want to share?
This issue is present in 7.3.1 and 8.0.0-pre.20240821.2 with remote cache enabled (since
--remote_download_toplevel
is default). In the above reproducer I use--disk_cache
for simplicity, but it also happens with a proper remote cache. The issue is also present in 6.4.0 if I enable--remote_download_toplevel
, but for whatever reason I couldn't reproduce with--disk_cache
, only a proper remote cache.The text was updated successfully, but these errors were encountered: