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

crate_universe + bzlmod breaks with pre-release version of bazel #2839

Closed
konkers opened this issue Sep 5, 2024 · 3 comments
Closed

crate_universe + bzlmod breaks with pre-release version of bazel #2839

konkers opened this issue Sep 5, 2024 · 3 comments

Comments

@konkers
Copy link
Contributor

konkers commented Sep 5, 2024

Bazel has changed its repository name separator character from ~ to + so rules_rust~~rust_host_tools~rust_host_tools become rules_rust++rust_host_tools+rust_host_tools. These +s conflict with the logic in https://github.com/bazelbuild/rules_rust/blob/main/crate_universe/src/utils.rs#L30 which assumes they come from cargo vendor.

Steps to reproduce:

  • Check out rules rust at e97988273b809b6fb5e435478469cd19ab76526c
  • change examples/bzlmod/.bazelversion to d62e0a0f32188e1875bb8e62ef4377ea4dc1aab2
  • cd to examples/bzlmod/all_crate_deps
  • run bazelisk test //...

The build will fail with:

ERROR: Traceback (most recent call last):
        File "/private/var/tmp/_bazel_konkers/a8dfe56ae7c980ef250452d78696ce61/external/rules_rust+/crate_universe/extension.bzl", line 369, column 37, in _crate_impl
                _generate_hub_and_spokes(module_ctx, cargo_bazel, cfg, annotations, cargo_lockfile = cargo_lockfile, manifests = manifests)
        File "/private/var/tmp/_bazel_konkers/a8dfe56ae7c980ef250452d78696ce61/external/rules_rust+/crate_universe/extension.bzl", line 139, column 16, in _generate_hub_and_spokes
                cargo_bazel([
        File "/private/var/tmp/_bazel_konkers/a8dfe56ae7c980ef250452d78696ce61/external/rules_rust+/crate_universe/private/module_extensions/cargo_bazel_bootstrap.bzl", line 66, column 17, in run
                fail("%s returned with exit code %d:\n%s" % (pretty_args, result.return_code, result.stderr))
Error in fail: /private/var/tmp/_bazel_konkers/a8dfe56ae7c980ef250452d78696ce61/external/rules_rust++cargo_bazel_bootstrap+cargo_bazel_bootstrap/cargo-bazel generate --cargo-lockfile /Users/konkers/work/rules_rust/examples/bzlmod/all_crate_deps/Cargo.lock --config /private/var/tmp/_bazel_konkers/a8dfe56ae7c980ef250452d78696ce61/modextwd/rules_rust++crate/crates/config.json --splicing-manifest /private/var/tmp/_bazel_konkers/a8dfe56ae7c980ef250452d78696ce61/modextwd/rules_rust++crate/crates/splicing_manifest.json --repository-dir /private/var/tmp/_bazel_konkers/a8dfe56ae7c980ef250452d78696ce61/modextwd/rules_rust++crate/crates --metadata /private/var/tmp/_bazel_konkers/a8dfe56ae7c980ef250452d78696ce61/modextwd/rules_rust++crate/crates/splicing-output/metadata.json --repin --lockfile /private/var/tmp/_bazel_konkers/a8dfe56ae7c980ef250452d78696ce61/modextwd/rules_rust++crate/crates/lockfile.json --cargo /private/var/tmp/_bazel_konkers/a8dfe56ae7c980ef250452d78696ce61/external/rules_rust++rust_host_tools+rust_host_tools/bin/cargo --rustc /private/var/tmp/_bazel_konkers/a8dfe56ae7c980ef250452d78696ce61/external/rules_rust++rust_host_tools+rust_host_tools/bin/rustc returned with exit code 101:
thread 'main' panicked at src/utils.rs:49:22:
Could not rename paths: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
ERROR: error evaluating module extension crate in @@rules_rust+//crate_universe:extension.bzl
@criemen
Copy link
Contributor

criemen commented Sep 6, 2024

This is essentially a duplicate of #2801, except that bazel HEAD has that incompatible flag flipped by default.

@konkers
Copy link
Contributor Author

konkers commented Sep 6, 2024

I'm going to close this one and consolidate discussion on #2801

@criemen
Copy link
Contributor

criemen commented Oct 4, 2024

Fixed by #2908, but I lack the permissions to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants