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

SBOMs break bottle reproducibility #17281

Closed
3 tasks done
carlocab opened this issue May 11, 2024 · 18 comments · Fixed by #17284
Closed
3 tasks done

SBOMs break bottle reproducibility #17281

carlocab opened this issue May 11, 2024 · 18 comments · Fixed by #17284
Assignees
Labels
bug Reproducible Homebrew/brew bug

Comments

@carlocab
Copy link
Member

carlocab commented May 11, 2024

brew doctor output

❯ brew dr
Your system is ready to brew.

Verification

  • My "brew doctor output" above says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update twice and am still able to reproduce my issue.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

brew config output

❯ brew config
HOMEBREW_VERSION: 4.2.21-109-g71c4bfa
ORIGIN: https://github.com/Homebrew/brew
HEAD: 71c4bfae79852b28d299de51a3007149bfe44073
Last commit: 4 hours ago
Core tap HEAD: 70912b0a1127e1b4fb3f50298b6f843b495a19fb
Core tap last commit: 18 minutes ago
Core tap JSON: 10 May 16:11 UTC
Core cask tap HEAD: 5be9a58d025d2db4fe8dd96089c9bd65600cba24
Core cask tap last commit: 34 minutes ago
Core cask tap JSON: 10 May 16:11 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_BAT: set
HOMEBREW_BOOTSNAP: set
HOMEBREW_CASK_OPTS: []
HOMEBREW_COLOR: set
HOMEBREW_DEVELOPER: set
HOMEBREW_EDITOR: nvim
HOMEBREW_FORCE_BREWED_CURL: set
HOMEBREW_FORCE_BREWED_GIT: set
HOMEBREW_GIT_EMAIL: 30379873+carlocab@users.noreply.github.com
HOMEBREW_GIT_NAME: Carlo Cabrera
HOMEBREW_MAKE_JOBS: 16
HOMEBREW_NO_AUTO_UPDATE: set
HOMEBREW_NO_CLEANUP_FORMULAE: zsh
HOMEBREW_NO_INSTALL_FROM_API: set
HOMEBREW_PRY: set
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.1.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: 16-core 64-bit arm_palma
Clang: 15.0.0 build 1500
Git: 2.45.0 => /opt/homebrew/opt/git/bin/git
Curl: 8.7.1 => /opt/homebrew/opt/curl/bin/curl
macOS: 14.4.1-arm64
CLT: 15.3.0.0.1.1708646388
Xcode: 15.3
Rosetta 2: false

What were you trying to do (and why)?

Figure out why we don't have an :all bottle at Homebrew/homebrew-core@0894397 (because :all bottles are nice).

To examine the differences between the bottles, I used diffoscope.

What happened (include all command output)?

diffoscope showed that the bottles have differing sbom.spdx.json files.

diffoscope output
--- bottles_ubuntu-22.04/osinfo-db--20240510.x86_64_linux.bottle.tar.gz
+++ bottles_14-arm64-9046359873/osinfo-db--20240510.arm64_sonoma.bottle.tar.gz
│   --- osinfo-db--20240510.x86_64_linux.bottle.tar
├── +++ osinfo-db--20240510.arm64_sonoma.bottle.tar
│ ├── file list
│ │ @@ -1,12 +1,12 @@
│ │  drwxr-xr-x   0        0        0        0 2024-05-10 10:31:02.000000 osinfo-db/20240510/
│ │  drwxr-xr-x   0        0        0        0 2024-05-10 10:31:02.000000 osinfo-db/20240510/.brew/
│ │  -rw-r--r--   0        0        0      667 2024-05-10 10:31:02.000000 osinfo-db/20240510/.brew/osinfo-db.rb
│ │  -rw-r--r--   0        0        0    17987 2024-05-10 10:31:02.000000 osinfo-db/20240510/LICENSE
│ │ --rw-r--r--   0        0        0     2727 2024-05-10 10:31:02.000000 osinfo-db/20240510/sbom.spdx.json
│ │ +-rw-r--r--   0        0        0     2719 2024-05-10 10:31:02.000000 osinfo-db/20240510/sbom.spdx.json
│ │  drwxr-xr-x   0        0        0        0 2024-05-10 10:31:02.000000 osinfo-db/20240510/share/
│ │  drwxr-xr-x   0        0        0        0 2024-05-10 10:31:02.000000 osinfo-db/20240510/share/osinfo/
│ │  -rw-r--r--   0        0        0    17987 2024-05-10 10:31:02.000000 osinfo-db/20240510/share/osinfo/LICENSE
│ │  -rw-r--r--   0        0        0        8 2024-05-10 10:31:02.000000 osinfo-db/20240510/share/osinfo/VERSION
│ │  drwxr-xr-x   0        0        0        0 2024-05-10 10:31:02.000000 osinfo-db/20240510/share/osinfo/datamap/
│ │  drwxr-xr-x   0        0        0        0 2024-05-10 10:31:02.000000 osinfo-db/20240510/share/osinfo/datamap/microsoft.com/
│ │  -rw-r--r--   0        0        0     1691 2024-05-10 10:31:02.000000 osinfo-db/20240510/share/osinfo/datamap/microsoft.com/win-7-l10n-language.xml
│ ├── osinfo-db/20240510/sbom.spdx.json
│ │ ├── Pretty-printed
│ │ │ @@ -1,11 +1,11 @@
│ │ │  {
│ │ │      "SPDXID": "SPDXRef-DOCUMENT",
│ │ │      "creationInfo": {
│ │ │ -        "created": "2024-05-11T20:59:00+00:00",
│ │ │ +        "created": "2024-05-11T17:00:13-04:00",
│ │ │          "creators": [
│ │ │              "Tool: https://github.com/homebrew/brew@4.2.21-109-g71c4bfa"
│ │ │          ]
│ │ │      },
│ │ │      "dataLicense": "CC0-1.0",
│ │ │      "documentDescribes": [
│ │ │          "SPDXRef-Archive-osinfo-db-src",
│ │ │ @@ -14,15 +14,15 @@
│ │ │      ],
│ │ │      "documentNamespace": "https://formulae.brew.sh/spdx/osinfo-db-20240510.json",
│ │ │      "files": [],
│ │ │      "name": "SBOM-SPDX-osinfo-db-20240510",
│ │ │      "packages": [
│ │ │          {
│ │ │              "SPDXID": "SPDXRef-Archive-osinfo-db-src",
│ │ │ -            "builtDate": "2024-05-10 10:31:02 +0000",
│ │ │ +            "builtDate": "2024-05-10 06:31:02 -0400",
│ │ │              "checksums": [
│ │ │                  {
│ │ │                      "algorithm": "SHA256",
│ │ │                      "checksumValue": "08a2d521c485687f6be39940d5b3f61bc0f583bb7e3655a131c658385eb7e5ca"
│ │ │                  }
│ │ │              ],
│ │ │              "copyrightText": "NOASSERTION",
│ │ │ @@ -39,20 +39,20 @@
│ │ │              "checksums": [],
│ │ │              "copyrightText": "NOASSERTION",
│ │ │              "downloadLocation": "NOASSERTION",
│ │ │              "externalRefs": [],
│ │ │              "filesAnalyzed": false,
│ │ │              "licenseConcluded": "NOASSERTION",
│ │ │              "licenseDeclared": "NOASSERTION",
│ │ │ -            "name": "gcc-11",
│ │ │ -            "versionInfo": "NOASSERTION"
│ │ │ +            "name": "clang",
│ │ │ +            "versionInfo": "15.3"
│ │ │          },
│ │ │          {
│ │ │              "SPDXID": "SPDXRef-Bottle-osinfo-db",
│ │ │ -            "builtDate": "2024-05-10 10:31:02 +0000",
│ │ │ +            "builtDate": "2024-05-10 06:31:02 -0400",
│ │ │              "checksums": [
│ │ │                  {
│ │ │                      "algorithm": "SHA256",
│ │ │                      "checksumValue": "a8c86aee5fd157554d85aa0a28d4c12bc5bdf03ccb5e67ac5c8c524d78bd1971"
│ │ │                  }
│ │ │              ],
│ │ │              "copyrightText": "NOASSERTION",

What did you expect to happen?

These bottles are identical, so they should not have different contents.

Step-by-step reproduction instructions (by running brew commands)

gh run download 9046359873 -p 'bottles*' -R Homebrew/homebrew-core
diffoscope bottles_ubuntu-22.04/osinfo-db--20240510.x86_64_linux.bottle.tar.gz bottles_14-arm64-9046359873/osinfo-db--20240510.arm64_sonoma.bottle.tar.gz
@carlocab carlocab added the bug Reproducible Homebrew/brew bug label May 11, 2024
@carlocab
Copy link
Member Author

CC @SMillerDev

@SMillerDev
Copy link
Member

I'll have to find where this is ignored for tabs since we can't really make sure it's the same. I can probably fix the build date though

SMillerDev added a commit to SMillerDev/brew that referenced this issue May 12, 2024
@carlocab
Copy link
Member Author

I'll have to find where this is ignored for tabs since we can't really make sure it's the same.

Yup, they will indeed be different. It isn't ignored for tabs -- they're just not stored in the bottle, so they don't affect the bottle checksum.

@Bo98
Copy link
Member

Bo98 commented May 12, 2024

Yes, for tabs we don't store this stuff in the bottles - we store them in GitHub Packages manifest annotations instead.

@MikeMcQuaid
Copy link
Member

Yes, for tabs we don't store this stuff in the bottles - we store them in GitHub Packages manifest annotations instead.

We should do the same thing for SBOMs dates/times as we do for Tab runtime dependencies: update them after installation (based on the dates/times from the tab):

# Update tab with actual runtime dependencies
tab = keg.tab
Tab.clear_cache
f_runtime_deps = formula.runtime_dependencies(read_from_tab: false)
tab.runtime_dependencies = Tab.runtime_deps_hash(formula, f_runtime_deps)
tab.write

@SMillerDev
Copy link
Member

Not sure how to resolve this. We could not write the field if the compiler is the system one maybe? Or, which affects the usefulness iyam, we could drop the bottle inclusion of the file and only write it on install.

@MikeMcQuaid
Copy link
Member

I think in an ideal world we'd detect if the compiler was actually used somehow e.g. write a temporary file on first usage of one of the compiler shims.

In cases like this, it's pretty clear that the compiler isn't actually used or a dependency.

@Bo98
Copy link
Member

Bo98 commented May 12, 2024

If compiler information needs to be available in the bottle archive via brew fetch (though this archive isn't necessarily representative of a complete install as it's pre-relocation): avoiding system compiler makes sense

If compiler information only needs to be available in the Cellar after brew install: SBOM already fetches the compiler from the tab, so we can exclude it and attach it back again on install.

@MikeMcQuaid
Copy link
Member

If compiler information only needs to be available in the Cellar after brew install: SBOM already fetches the compiler from the tab, so we can exclude it and attach it back again on install.

Yes, this seems best for now.

@carlocab
Copy link
Member Author

If compiler information only needs to be available in the Cellar after brew install: SBOM already fetches the compiler from the tab, so we can exclude it and attach it back again on install.

Yes, this seems best for now.

This is fine, but it might not be enough. The sbom.spdx.json files also reference bottle checksum of dependencies, which in general be different across OS versions even for existing :all bottles. Unless this information is generated during brew fetch?

@carlocab
Copy link
Member Author

Confusingly, the SBOM also seems to contain this snippet:

    {
      "SPDXID": "SPDXRef-Bottle-node@20",
      "name": "node@20",
      "versionInfo": "20.13.1",
      "filesAnalyzed": false,
      "licenseDeclared": "NOASSERTION",
      "builtDate": "2024-05-09 05:20:38 -0400",
      "licenseConcluded": "MIT",
      "downloadLocation": "https://ghcr.io/v2/homebrew/core/node/20/blobs/sha256:a865d16c32d50cdffe26e341fb6a8d52b7c3f95daf10e2a390fb988c4fba0ab3",
      "copyrightText": "NOASSERTION",
      "externalRefs": [
        {
          "referenceCategory": "PACKAGE-MANAGER",
          "referenceLocator": "pkg:brew/homebrew/core/node@20@20.13.1",
          "referenceType": "purl"
        }
      ],
      "checksums": [
        {
          "algorithm": "SHA256",
          "checksumValue": "a865d16c32d50cdffe26e341fb6a8d52b7c3f95daf10e2a390fb988c4fba0ab3"
        }
      ]
    }

Except that the download location (and checksum) is not for the version indicated (20.13.1). Instead, it points to the location and checksum of 20.13.0. Which kinda makes sense, because you can't really write a file containing the checksum of the bottle inside the bottle. (Or I could just be very confused about what's going on here, which is also a possibility.)

@MikeMcQuaid
Copy link
Member

Except that the download location (and checksum) is not for the version indicated (20.13.1). Instead, it points to the location and checksum of 20.13.0. Which kinda makes sense, because you can't really write a file containing the checksum of the bottle inside the bottle. (Or I could just be very confused about what's going on here, which is also a possibility.)

This also should be removed at bottling time and restored at install time.

MikeMcQuaid added a commit that referenced this issue May 13, 2024
- Remove use of (unused) `Cachable` module.
- Pass whether we're bottling to determine whether to create
  reproducible SBOM or not. A reproducible SBOM omits the time and
  compiler.
- Remove bottle information when bottling: we cannot know what e.g.
  the checksum (and, with GitHub Packages, therefore also the download
  location) will be before we've created the tarball contents.
- Always write a bottle on installation (unless we're bottling) to
  provide new bottle information or freshen the existing one with the
  information we stripped out for reproducibility e.g. the time and
  compiler.
- Don't need to handle a `nil` `@source_modified_time` as it's always
  set.

Fixes #17281
@MikeMcQuaid MikeMcQuaid self-assigned this May 13, 2024
MikeMcQuaid added a commit that referenced this issue May 13, 2024
- Remove use of (unused) `Cachable` module.
- Pass whether we're bottling to determine whether to create
  reproducible SBOM or not. A reproducible SBOM omits the time and
  compiler.
- Remove bottle information when bottling: we cannot know what e.g.
  the checksum (and, with GitHub Packages, therefore also the download
  location) will be before we've created the tarball contents.
- Always write a bottle on installation (unless we're bottling) to
  provide new bottle information or freshen the existing one with the
  information we stripped out for reproducibility e.g. the time and
  compiler.
- Don't need to handle a `nil` `@source_modified_time` as it's always
  set.

Fixes #17281
MikeMcQuaid added a commit that referenced this issue May 13, 2024
- Remove use of (unused) `Cachable` module.
- Pass whether we're bottling to determine whether to create
  reproducible SBOM or not. A reproducible SBOM omits the time and
  compiler.
- Remove bottle information when bottling: we cannot know what e.g.
  the checksum (and, with GitHub Packages, therefore also the download
  location) will be before we've created the tarball contents.
- Always write a bottle on installation (unless we're bottling) to
  provide new bottle information or freshen the existing one with the
  information we stripped out for reproducibility e.g. the time and
  compiler.
- Don't need to handle a `nil` `@source_modified_time` as it's always
  set.

Fixes #17281
@MikeMcQuaid
Copy link
Member

Confirmed rebottling in Homebrew/homebrew-core#171540 post #17284 fixes the bottles 🎉

@carlocab
Copy link
Member Author

Thanks @MikeMcQuaid ❤️

@carlocab carlocab reopened this May 25, 2024
@carlocab
Copy link
Member Author

carlocab commented May 25, 2024

This is still happening. See Homebrew/homebrew-core@fd1c80d.

Diffoscope Output
--- ~/Library/Caches/Homebrew/downloads/10141ca57ddfafa18b2a0efeaac4f8206739805a36d435c886951987fb4ccaa8--ruby-build--20240517.arm64_ventura.bottle.tar.gz
+++ ~/Library/Caches/Homebrew/downloads/aa750a673b84ed5679172e6c6b4a944dce68ee6f7dc6e1b310c5d63c4df83e0a--ruby-build--20240517.arm64_sonoma.bottle.tar.gz
│   --- 10141ca57ddfafa18b2a0efeaac4f8206739805a36d435c886951987fb4ccaa8--ruby-build--20240517.arm64_ventura.bottle.tar
├── +++ aa750a673b84ed5679172e6c6b4a944dce68ee6f7dc6e1b310c5d63c4df83e0a--ruby-build--20240517.arm64_sonoma.bottle.tar
│ ├── ruby-build/20240517/sbom.spdx.json
│ │ ├── Pretty-printed
│ │ │ @@ -40,19 +40,19 @@
│ │ │              "versionInfo": "20240517"
│ │ │          },
│ │ │          {
│ │ │              "SPDXID": "SPDXRef-Package-SPDXRef-m4-1.4.19",
│ │ │              "checksums": [
│ │ │                  {
│ │ │                      "algorithm": "SHA256",
│ │ │ -                    "checksumValue": "11308abe8d607be35da9e88a1d789f191914bf043bca4fdde2b50a6cbf1713cc"
│ │ │ +                    "checksumValue": "f42d89db519a07d67bcaead6c8dfb2da45e8266bebb996dd8b3f19b1ca13b8a0"
│ │ │                  }
│ │ │              ],
│ │ │              "copyrightText": "NOASSERTION",
│ │ │ -            "downloadLocation": "https://ghcr.io/v2/homebrew/core/m4/blobs/sha256:11308abe8d607be35da9e88a1d789f191914bf043bca4fdde2b50a6cbf1713cc",
│ │ │ +            "downloadLocation": "https://ghcr.io/v2/homebrew/core/m4/blobs/sha256:f42d89db519a07d67bcaead6c8dfb2da45e8266bebb996dd8b3f19b1ca13b8a0",
│ │ │              "externalRefs": [
│ │ │                  {
│ │ │                      "referenceCategory": "PACKAGE-MANAGER",
│ │ │                      "referenceLocator": "pkg:brew/m4@1.4.19",
│ │ │                      "referenceType": "purl"
│ │ │                  }
│ │ │              ],
│ │ │ @@ -86,19 +86,19 @@
│ │ │              "versionInfo": "2.72"
│ │ │          },
│ │ │          {
│ │ │              "SPDXID": "SPDXRef-Package-SPDXRef-libyaml-0.2.5",
│ │ │              "checksums": [
│ │ │                  {
│ │ │                      "algorithm": "SHA256",
│ │ │ -                    "checksumValue": "11239e8f5066c6d0d0718208d4eab518da00c7289f33c9c76c0a09ba5c0417c9"
│ │ │ +                    "checksumValue": "98c0cf81bcdf7577d5fdc8cc18732970b9ae7e0e7423a733f88f0f566ba483ad"
│ │ │                  }
│ │ │              ],
│ │ │              "copyrightText": "NOASSERTION",
│ │ │ -            "downloadLocation": "https://ghcr.io/v2/homebrew/core/libyaml/blobs/sha256:11239e8f5066c6d0d0718208d4eab518da00c7289f33c9c76c0a09ba5c0417c9",
│ │ │ +            "downloadLocation": "https://ghcr.io/v2/homebrew/core/libyaml/blobs/sha256:98c0cf81bcdf7577d5fdc8cc18732970b9ae7e0e7423a733f88f0f566ba483ad",
│ │ │              "externalRefs": [
│ │ │                  {
│ │ │                      "referenceCategory": "PACKAGE-MANAGER",
│ │ │                      "referenceLocator": "pkg:brew/libyaml@0.2.5",
│ │ │                      "referenceType": "purl"
│ │ │                  }
│ │ │              ],
│ │ │ @@ -109,19 +109,19 @@
│ │ │              "versionInfo": "0.2.5"
│ │ │          },
│ │ │          {
│ │ │              "SPDXID": "SPDXRef-Package-SPDXRef-pkg-config-0.29.2_3",
│ │ │              "checksums": [
│ │ │                  {
│ │ │                      "algorithm": "SHA256",
│ │ │ -                    "checksumValue": "3ff612c5e44b945c8c0cc6df7d3edb407ca67cddad9c89f9ab99ced494b7a8c2"
│ │ │ +                    "checksumValue": "7b59abc0b5381065b1eab174217307af9324e0d02edf903171b29250ae58aeaf"
│ │ │                  }
│ │ │              ],
│ │ │              "copyrightText": "NOASSERTION",
│ │ │ -            "downloadLocation": "https://ghcr.io/v2/homebrew/core/pkg-config/blobs/sha256:3ff612c5e44b945c8c0cc6df7d3edb407ca67cddad9c89f9ab99ced494b7a8c2",
│ │ │ +            "downloadLocation": "https://ghcr.io/v2/homebrew/core/pkg-config/blobs/sha256:7b59abc0b5381065b1eab174217307af9324e0d02edf903171b29250ae58aeaf",
│ │ │              "externalRefs": [
│ │ │                  {
│ │ │                      "referenceCategory": "PACKAGE-MANAGER",
│ │ │                      "referenceLocator": "pkg:brew/pkg-config@0.29.2_3",
│ │ │                      "referenceType": "purl"
│ │ │                  }
│ │ │              ],
│ │ │ @@ -132,19 +132,19 @@
│ │ │              "versionInfo": "0.29.2_3"
│ │ │          },
│ │ │          {
│ │ │              "SPDXID": "SPDXRef-Package-SPDXRef-readline-8.2.10",
│ │ │              "checksums": [
│ │ │                  {
│ │ │                      "algorithm": "SHA256",
│ │ │ -                    "checksumValue": "90351660d5ceca72a4c0a287555f2045db95f78aa5f65011b94213429f729cde"
│ │ │ +                    "checksumValue": "713fd1fa8544426b7e97eb21d13153195fea4c407db8a174bd183777b81c9192"
│ │ │                  }
│ │ │              ],
│ │ │              "copyrightText": "NOASSERTION",
│ │ │ -            "downloadLocation": "https://ghcr.io/v2/homebrew/core/readline/blobs/sha256:90351660d5ceca72a4c0a287555f2045db95f78aa5f65011b94213429f729cde",
│ │ │ +            "downloadLocation": "https://ghcr.io/v2/homebrew/core/readline/blobs/sha256:713fd1fa8544426b7e97eb21d13153195fea4c407db8a174bd183777b81c9192",
│ │ │              "externalRefs": [
│ │ │                  {
│ │ │                      "referenceCategory": "PACKAGE-MANAGER",
│ │ │                      "referenceLocator": "pkg:brew/readline@8.2.10",
│ │ │                      "referenceType": "purl"
│ │ │                  }
│ │ │              ],
│ │ │ @@ -178,19 +178,19 @@
│ │ │              "versionInfo": "2024-03-11"
│ │ │          },
│ │ │          {
│ │ │              "SPDXID": "SPDXRef-Package-SPDXRef-openssl@3-3.3.0",
│ │ │              "checksums": [
│ │ │                  {
│ │ │                      "algorithm": "SHA256",
│ │ │ -                    "checksumValue": "58665ec9e2873dba2799be5992eab3973f230acc352d09bd4a69131ac3ccd2d4"
│ │ │ +                    "checksumValue": "ec6f9daf8e32d96f4a2f4cd56d18533ee47bb8d9e7cb3d832ac64115d8a1a4ca"
│ │ │                  }
│ │ │              ],
│ │ │              "copyrightText": "NOASSERTION",
│ │ │ -            "downloadLocation": "https://ghcr.io/v2/homebrew/core/openssl/3/blobs/sha256:58665ec9e2873dba2799be5992eab3973f230acc352d09bd4a69131ac3ccd2d4",
│ │ │ +            "downloadLocation": "https://ghcr.io/v2/homebrew/core/openssl/3/blobs/sha256:ec6f9daf8e32d96f4a2f4cd56d18533ee47bb8d9e7cb3d832ac64115d8a1a4ca",
│ │ │              "externalRefs": [
│ │ │                  {
│ │ │                      "referenceCategory": "PACKAGE-MANAGER",
│ │ │                      "referenceLocator": "pkg:brew/openssl@3@3.3.0",
│ │ │                      "referenceType": "purl"
│ │ │                  }
│ │ │              ],

This is basically the problem I describe at #17281 (comment).

@MikeMcQuaid
Copy link
Member

This is still happening. See Homebrew/homebrew-core@fd1c80d.

This is basically the problem I describe at #17281 (comment).

That problem was fixed. I cannot reproduce this locally. If I run brew bottle ack --json --only-json-tab I get:

  • the same checksum every time
  • a ack/3.7.0/sbom.spdx.json that does not contain any of the fields you mention

This was not the case before that was fixed.

This is because we're passing bottling: to skip these at brew bottle time:

sbom.write(bottling: true)

These values are only being added at brew install time:

sbom.write(validate: Homebrew::EnvConfig.developer?)

So this is an issue with either brew test-bot or our homebrew-core CI workflows that is somehow resulting in attempting to double-bottle or use older/cached, broken SBOMs in bottles or something. An issue should probably be opened somewhere but I don't think it's this issue and I don't think (for now) it's Homebrew/brew.

@carlocab
Copy link
Member Author

carlocab commented May 26, 2024

That problem was fixed. I cannot reproduce this locally. If I run brew bottle ack --json --only-json-tab

No, it is not fixed. You cannot reproduce this problem with ack because ack has no dependencies. You need to do it with something like ruby-build.

Doing brew bottle ruby-build --json --only-json-tab produces a ruby-build/20240517/sbom.spdx.json that contains fields like

    {
      "SPDXID": "SPDXRef-Package-SPDXRef-openssl@3-3.3.0",
      "name": "openssl@3",
      "versionInfo": "3.3.0",
      "filesAnalyzed": false,
      "licenseDeclared": "NOASSERTION",
      "licenseConcluded": "Apache-2.0",
      "downloadLocation": "https://ghcr.io/v2/homebrew/core/openssl/3/blobs/sha256:ec6f9daf8e32d96f4a2f4cd56d18533ee47bb8d9e7cb3d832ac64115d8a1a4ca",
      "copyrightText": "NOASSERTION",
      "checksums": [
        {
          "algorithm": "SHA256",
          "checksumValue": "ec6f9daf8e32d96f4a2f4cd56d18533ee47bb8d9e7cb3d832ac64115d8a1a4ca"
        }
      ],
      "externalRefs": [
        {
          "referenceCategory": "PACKAGE-MANAGER",
          "referenceLocator": "pkg:brew/openssl@3@3.3.0",
          "referenceType": "purl"
        }
      ]
    }

which will, in general, prevent the creation of :all bottles.

@MikeMcQuaid
Copy link
Member

Doing brew bottle ruby-build --json --only-json-tab

Ok, thanks for the reproduction command. It was not clear how to reproduce this before and not clear to me until rereading that this was an additional issue unrelated to reproducibility but related to :all bottles specifically.

#17370 should address this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Reproducible Homebrew/brew bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants