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 renders different MODULE.bazel.lock on windows vs linux #2878

Open
UebelAndre opened this issue Sep 17, 2024 · 1 comment
Open

Comments

@UebelAndre
Copy link
Collaborator

UebelAndre commented Sep 17, 2024

Noticed on #2866, the bzlmod BCR presubmit on windows job was failing with:

(23:33:40) ERROR: Analysis of target '//:hello_world_vendored_test' failed; build aborted: MODULE.bazel.lock is no longer up-to-date because: The implementation of the extension 'ModuleExtensionId{bzlFileLabel=//third-party:extension.bzl, extensionName=crate_repositories, isolationKey=Optional.empty}' or one of its transitive .bzl files has changed. Please run `bazel mod deps --lockfile_mode=update` to update your lockfile.
(23:33:40) INFO: Elapsed time: 0.955s, Critical Path: 0.00s
(23:33:40) INFO: 1 process: 1 internal.
(23:33:40) ERROR: Build did NOT complete successfully
(23:33:40) ERROR: No test targets were found, yet testing was requested
(23:33:40) FAILED:

When the command is run on a Windows machine, the following diff is produced:

diff --git a/examples/bzlmod/hello_world/MODULE.bazel.lock b/examples/bzlmod/hello_world/MODULE.bazel.lock
index 3607ba47..9d6394a3 100644
--- a/examples/bzlmod/hello_world/MODULE.bazel.lock
+++ b/examples/bzlmod/hello_world/MODULE.bazel.lock
@@ -99,7 +99,7 @@
   "moduleExtensions": {
     "//third-party:extension.bzl%crate_repositories": {
       "general": {
-        "bzlTransitiveDigest": "i4yp7qUetvedeDhOvPj+9+Z5HfpBKTv4QPEg1cnDRSA=",
+        "bzlTransitiveDigest": "cqUx6n/ORKXs8rhE+nTohXqemXAxMv6A1y6mRnxmPhE=",
         "usagesDigest": "n26CV4cfVuxRixL8viN6C0ux4GOeMd3TcVWLDi3yEXg=",
         "recordedFileInputs": {},
         "recordedDirentsInputs": {},
@@ -2831,7 +2831,7 @@
     },
     "@@rules_rust~//crate_universe/private/module_extensions:cargo_bazel_bootstrap.bzl%cargo_bazel_bootstrap": {
       "general": {
-        "bzlTransitiveDigest": "BNk2lSmPFvhtV2uT4kYvPZC6XqgtYX6MS+wBOWpNTxk=",
+        "bzlTransitiveDigest": "7G+kRVBstF4io/kCfSVeSVfuFb9PJlHnmrFAEykEq0E=",
         "usagesDigest": "4j52H63OB19ipuXlWqw5ELkm0MSoKrHSwWb5leP5KX8=",
         "recordedFileInputs": {},
         "recordedDirentsInputs": {},
@@ -2927,7 +2927,7 @@
     },
     "@@rules_rust~//rust:extensions.bzl%rust": {
       "general": {
-        "bzlTransitiveDigest": "SqTykb9lmI/W1mnXjM79nHEoAHh0BjNsrDztK+foV3c=",
+        "bzlTransitiveDigest": "6JH7szw8e4pL95SFQIjCCR0MPssZDOKdQWuuzbrid7A=",
         "usagesDigest": "/n9pwvYUZ8UYxB543f13GdnGNL3Ml6QTEjAwNOE+bK8=",
         "recordedFileInputs": {},
         "recordedDirentsInputs": {},
@@ -6015,7 +6015,7 @@
     },
     "@@rules_rust~//rust/private:extensions.bzl%i": {
       "general": {
-        "bzlTransitiveDigest": "yaWbGvJJUd5992MNUvdpjcJmOKazeMhdsCkOQ2X22R4=",
+        "bzlTransitiveDigest": "6pDWGWNg5oMNG2orw6UPfYVg7eZw1kGPMZLW179f9n0=",
         "usagesDigest": "UNpcnQXQKPinVDqLbfIv+tb5J6eu9Z+wiU0L5bDyWDY=",
         "recordedFileInputs": {},
         "recordedDirentsInputs": {},
@@ -14247,7 +14247,7 @@
             "bzlFile": "@@bazel_tools//tools/build_defs/repo:http.bzl",
             "ruleClassName": "http_archive",
             "attributes": {
-              "build_file_content": "load(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\n\nrust_library(\n    name = \"libc\",\n    srcs = glob([\"src/**/*.rs\"]),\n    edition = \"2015\",\n    rustc_flags = [\n        # In most cases, warnings in 3rd party crates are not interesting as\n        # they're out of the control of consumers. The flag here silences\n        # warnings. For more details see:\n        # https://doc.rust-lang.org/rustc/lints/levels.html\n        \"--cap-lints=allow\",\n    ],\n    visibility = [\"//visibility:public\"],\n)\n",
+              "build_file_content": "load(\"@rules_rust//rust:defs.bzl\", \"rust_library\")\r\n\r\nrust_library(\r\n    name = \"libc\",\r\n    srcs = glob([\"src/**/*.rs\"]),\r\n    edition = \"2015\",\r\n    rustc_flags = [\r\n        # In most cases, warnings in 3rd party crates are not interesting as\r\n        # they're out of the control of consumers. The flag here silences\r\n        # warnings. For more details see:\r\n        # https://doc.rust-lang.org/rustc/lints/levels.html\r\n        \"--cap-lints=allow\",\r\n    ],\r\n    visibility = [\"//visibility:public\"],\r\n)\r\n",
               "sha256": "1ac4c2ac6ed5a8fb9020c166bc63316205f1dc78d4b964ad31f4f21eb73f0c6d",
               "strip_prefix": "libc-0.2.20",
               "urls": [

Note the use of \r\n in the MODULE.bazel.lock file vs \n. These should probably be updated to always render \n.

@illicitonion
Copy link
Collaborator

Hopefully #2939 fixes this? Maybe?

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

2 participants