bazelbuild / bazelbuild/platforms

Different bzlmod lock digest on different host platforms

Open
#110 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
124
Forks
94
PR merge metrics
No merged PRs in 30d

Description

When using bzlmod on two slightly different host platforms (Ubuntu with glibc 2.39 and Debian with glibc 2.40), the `usageDigest` hash of `@platforms//host:extension.bzl%host_platform` changes:

```diff
--- a/MODULE.bazel.lock
+++ b/MODULE.bazel.lock
@@ -92,7 +95,7 @@
"@@platforms//host:extension.bzl%host_platform": {
"general": {
"bzlTransitiveDigest": "xelQcPZH8+tmuOHVjL9vDxMnnQNMlwj0SlvgoqBkm4U=",
- "usagesDigest": "meSzxn3DUCcYEhq4HQwExWkWtU4EjriRBQLsZN+Q0SU=",
+ "usagesDigest": "pCYpDQmqMbmiiPI1p2Kd3VLm5T48rRAht5WdW0X2GlA=",
"recordedFileInputs": {},
"recordedDirentsInputs": {},
"envVariables": {},
```

This is an issue when the lockfile is checked into the repo.

From some investigation, it seems that module extensions must set the `use_os` and `use_arch` parameters if they are dependent on the OS or architecture:

https://github.com/bazelbuild/bazel/commit/2f032d452f78ce4b555d61dff2ba0f5db503511d

I believe this applies to `host_platform` too since its behaviour changes based on the OS. Should these parameters be set, or am I misunderstanding?

Apologies for the lack of minimal reproduction, this is quite difficult to test.

**EDIT**: I see these params were renamed to `os_dependent` and `arch_dependent`.

Contributor guide

Open the contributing guide

Research direction

Start by inspecting MODULE.bazel.lock and the @platforms//host:extension.bzl%host_platform entry, then review the referenced Bazel commit and the renamed os_dependent and arch_dependent parameters. Reproduce the lockfile generation on the Ubuntu/glibc 2.39 and Debian/glibc 2.40 hosts if possible; done means determining whether host_platform declares its platform dependencies correctly and documenting the result.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.