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

HEAD-only formulae can no longer be installed #17333

Closed
3 tasks done
tbvdm opened this issue May 18, 2024 · 1 comment · Fixed by #17336
Closed
3 tasks done

HEAD-only formulae can no longer be installed #17333

tbvdm opened this issue May 18, 2024 · 1 comment · Fixed by #17336
Assignees
Labels
bug Reproducible Homebrew/brew bug

Comments

@tbvdm
Copy link

tbvdm commented May 18, 2024

brew doctor output

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

HOMEBREW_VERSION: 4.3.0
ORIGIN: https://github.com/Homebrew/brew
HEAD: 8378cc825d83acffd125fb0fec041793df378a57
Last commit: 5 days ago
Core tap JSON: 14 May 22:34 UTC
Core cask tap JSON: 14 May 22:34 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: ["--no-quarantine"]
HOMEBREW_COLOR: set
HOMEBREW_MAKE_JOBS: 3
HOMEBREW_NO_AUTO_UPDATE: set
HOMEBREW_NO_INSTALL_CLEANUP: set
Homebrew Ruby: 3.1.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: 3-core 64-bit dunno
Clang: 15.0.0 build 1500
Git: 2.39.3 => /Applications/Xcode_15.0.1.app/Contents/Developer/usr/bin/git
Curl: 8.4.0 => /usr/bin/curl
macOS: 14.4.1-arm64
CLT: 15.3.0.0.1.1708646388
Xcode: 15.0.1 => /Applications/Xcode_15.0.1.app/Contents/Developer
Rosetta 2: false

What were you trying to do (and why)?

I have a tap with a few HEAD-only formulae. Installing these formulae has recently started to fail, presumably because of the recent SBOM changes.

What happened (include all command output)?

The installation failed. Please see the reproducer below for details.

What did you expect to happen?

The installation should succeed.

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

This example uses awk.rb to illustrate the problem.

Fetch awk.rb and install its HEAD version. This works as expected:

$ curl -LO https://github.com/Homebrew/homebrew-core/raw/HEAD/Formula/a/awk.rb
$ brew install --verbose --HEAD --formula awk.rb

Now remove the "url" and "sha256" fields from awk.rb (thus turning it into a
HEAD-only formula) and try to install the HEAD version again. This fails:

$ sed -i -e /url/,/sha256/d awk.rb
$ brew uninstall awk
$ brew install --verbose --HEAD --formula awk.rb
[...]
==> Finishing up
ln -s ../Cellar/awk/HEAD-f8be48f/bin/awk awk
ln -s ../../../Cellar/awk/HEAD-f8be48f/share/man/man1/awk.1 awk.1
Error: undefined method `bottle_specification' for nil:NilClass
/opt/homebrew/Library/Homebrew/formula.rb:2582:in `bottle_hash'
/opt/homebrew/Library/Homebrew/sbom.rb:37:in `create'
/opt/homebrew/Library/Homebrew/formula_installer.rb:834:in `finish'
/opt/homebrew/Library/Homebrew/upgrade.rb:238:in `install_formula'
/opt/homebrew/Library/Homebrew/install.rb:350:in `install_formula'
/opt/homebrew/Library/Homebrew/install.rb:301:in `block in install_formulae'
/opt/homebrew/Library/Homebrew/install.rb:300:in `each'
/opt/homebrew/Library/Homebrew/install.rb:300:in `install_formulae'
/opt/homebrew/Library/Homebrew/cmd/install.rb:297:in `run'
/opt/homebrew/Library/Homebrew/brew.rb:92:in `<main>'
Please report this issue:
  https://docs.brew.sh/Troubleshooting
@tbvdm tbvdm added the bug Reproducible Homebrew/brew bug label May 18, 2024
@dtrodrigues
Copy link
Member

The installation is succeeding, but the SBOM generation after the installation is failing. This started as of #17254 .

@MikeMcQuaid MikeMcQuaid self-assigned this May 20, 2024
MikeMcQuaid added a commit that referenced this issue May 20, 2024
- be a bit stricter with SBOM handling with the test default formula
  flow in CI by making it raise errors if SBOM's aren't generated and
  validated as expected
- fix handling of HEAD installations of formulae so SBOM generation is
  both correct and doesn't raise errors
- make `Formula#bottle_hash` more accepting of edge cases e.g. HEAD-only
  formulae without a stable spec

Fixes #17333
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.

3 participants