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

formula: fix latest_version_installed? for HOMEBREW_JSON_CORE #11730

Merged
merged 1 commit into from Jul 16, 2021

Conversation

Rylan12
Copy link
Member

@Rylan12 Rylan12 commented Jul 16, 2021

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Follow-up to #11715

If HOMEBREW_JSON_CORE is set, brew cleanup fails:

$ brew cleanup
Error: no implicit conversion of nil into String
Please report this issue:
  https://docs.brew.sh/Troubleshooting
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/pathname.rb:350:in `initialize'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/pathname.rb:350:in `new'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/pathname.rb:350:in `+'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2351:in `versioned_prefix'
/usr/local/Homebrew/Library/Homebrew/formula.rb:597:in `prefix'
/usr/local/Homebrew/Library/Homebrew/formula.rb:524:in `latest_version_installed?'
/usr/local/Homebrew/Library/Homebrew/formula.rb:2257:in `eligible_kegs_for_cleanup'
/usr/local/Homebrew/Library/Homebrew/cleanup.rb:237:in `cleanup_formula'
/usr/local/Homebrew/Library/Homebrew/cleanup.rb:190:in `block in clean!'
/usr/local/Homebrew/Library/Homebrew/cleanup.rb:189:in `each'
/usr/local/Homebrew/Library/Homebrew/cleanup.rb:189:in `clean!'
/usr/local/Homebrew/Library/Homebrew/cmd/cleanup.rb:58:in `cleanup'
/usr/local/Homebrew/Library/Homebrew/brew.rb:122:in `<main>'

This is because the updates to Formula#latest_version_installed? from #11715 did not handle the case where a formula wasn't found in the /api/versions.json file (which would happen for any non-core formula.

Now, if the formula isn't listed, default back to the old way of using latest_installed_prefix (which is still done if HOMEBREW_JSON_CORE is unset.

@Rylan12 Rylan12 added the critical Critical change which should be shipped as soon as possible. label Jul 16, 2021
@BrewTestBot
Copy link
Member

Review period skipped due to critical label.

@Rylan12 Rylan12 enabled auto-merge July 16, 2021 16:24
@Rylan12 Rylan12 merged commit dbcd764 into Homebrew:master Jul 16, 2021
@Rylan12 Rylan12 deleted the fix-latest-version-installed branch July 16, 2021 16:52
Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

@github-actions github-actions bot added the outdated PR was locked due to age label Aug 19, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
critical Critical change which should be shipped as soon as possible. outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants