You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When generating many build files with cargo-bazel in crates_vendor() rule. We can constantly see errors when running crates_vendor as part of pre-commit hook:
buildifier: open /.../third_party/rust/crates/BUILD.percent-encoding-1.0.1.bazel: no such file or directory
Error: Failed to run buildifier on /.../third_party/rust/crates/BUILD.percent-encoding-1.0.1.bazel
However, when run crates_vendor directly won't trigger this.
After looking into the source code, and relevant rust issues, fs::write should be the culprit.
As pointed out in rust-lang/rust#51775, fs::write doesn't force a sync in the end, so the newly created file may still sit in the os cache, which cannot be accessed by another process.
When generating many build files with
cargo-bazel
incrates_vendor()
rule. We can constantly see errors when runningcrates_vendor
as part of pre-commit hook:However, when run
crates_vendor
directly won't trigger this.After looking into the source code, and relevant rust issues,
fs::write
should be the culprit.https://github.com/bazelbuild/rules_rust/blob/4e593b6cc3e1dab70eed5fdec239ffc0b4179b91/crate_universe/src/rendering.rs#L820C13-L820C22
As pointed out in rust-lang/rust#51775,
fs::write
doesn't force a sync in the end, so the newly created file may still sit in the os cache, which cannot be accessed by another process.edit:
We are also seeing random errors from
rules_rust/crate_universe/src/cli/vendor.rs
Line 184 in 4e593b6
Directory not empty (os error 66)
.The text was updated successfully, but these errors were encountered: