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

Fix "undefined local variable" error in update-report #14903

Merged
merged 2 commits into from Mar 6, 2023

Conversation

dduugg
Copy link
Sponsor Member

@dduugg dduugg commented Mar 6, 2023

  • 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?

Resolves an error introduced in 2451d01#diff-05ec45190dab3db11df80b2c154648c8023837fa34917dce9d1bcde0acf9c005L282
If you have a few minutes and you're willing to untap core, you should be able to repro with:

$ brew untap homebrew/core; HOMEBREW_NO_INSTALL_FROM_API=1 brew update-report
Untapping homebrew/core...
Untapped 3 commands and 6552 formulae (15,331 files, 710.4MB).
==> Tapping homebrew/core
Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 1429703, done.
remote: Counting objects: 100% (318/318), done.
remote: Compressing objects: 100% (157/157), done.
remote: Total 1429703 (delta 190), reused 268 (delta 161), pack-reused 1429385
Receiving objects: 100% (1429703/1429703), 549.69 MiB | 3.90 MiB/s, done.
Resolving deltas: 100% (997762/997762), done.
Tapped 3 commands and 6554 formulae (6,906 files, 604.5MB).
Error: undefined local variable or method `core_tap' for Homebrew:Module
Please report this issue:
  https://docs.brew.sh/Troubleshooting
/opt/homebrew/Library/Homebrew/cmd/update-report.rb:318:in `install_core_tap_if_necessary'
/opt/homebrew/Library/Homebrew/cmd/update-report.rb:115:in `output_update_report'
/opt/homebrew/Library/Homebrew/cmd/update-report.rb:42:in `update_report'
/opt/homebrew/Library/Homebrew/brew.rb:93:in `<main>'

I've also enabled typechecking in update-report, which would have caught this error

@dduugg dduugg added the critical Critical change which should be shipped as soon as possible. label Mar 6, 2023
@BrewTestBot
Copy link
Member

Review period skipped due to critical label.

@dduugg dduugg changed the title Fix undefined local variable error in update-report Fix "undefined local variable" error in update-report Mar 6, 2023
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.

Good catch, thanks @dduugg!

@MikeMcQuaid MikeMcQuaid merged commit df1e1d6 into Homebrew:master Mar 6, 2023
20 of 23 checks passed
@hasufell
Copy link

hasufell commented Mar 9, 2023

I'm still seeing this in CI: https://gitlab.haskell.org/haskell/cabal/-/jobs/1398914

+ brew update
==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:cf9137b1da5568d4949f71161a69b101f60ddb765e94d2b423c9801b67a1cb43
######################################################################## 100.0%
==> Pouring portable-ruby-2.6.8_1.arm64_big_sur.bottle.tar.gz
�==> Homebrew has enabled anonymous aggregate formula and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics have been recorded yet (nor will be during this `brew` run).
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations
==> Tapping homebrew/core
Cloning into '/private/var/lib/gitlab-runner/builds/7KQsmDei/0/haskell/cabal/.brew/Library/Taps/homebrew/homebrew-core'...
Tapped 3 commands and 6[55](https://gitlab.haskell.org/haskell/cabal/-/jobs/1398914#L55)9 formulae (6,911 files, 605.5MB).
Error: undefined local variable or method `core_tap' for Homebrew:Module

@dduugg dduugg deleted the fix-update-report branch March 9, 2023 07:00
@dduugg
Copy link
Sponsor Member Author

dduugg commented Mar 9, 2023

I'm still seeing this in CI: https://gitlab.haskell.org/haskell/cabal/-/jobs/1398914

+ brew update
==> Downloading https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:cf9137b1da5568d4949f71161a69b101f60ddb765e94d2b423c9801b67a1cb43
######################################################################## 100.0%
==> Pouring portable-ruby-2.6.8_1.arm64_big_sur.bottle.tar.gz
�==> Homebrew has enabled anonymous aggregate formula and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics have been recorded yet (nor will be during this `brew` run).
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations
==> Tapping homebrew/core
Cloning into '/private/var/lib/gitlab-runner/builds/7KQsmDei/0/haskell/cabal/.brew/Library/Taps/homebrew/homebrew-core'...
Tapped 3 commands and 6[55](https://gitlab.haskell.org/haskell/cabal/-/jobs/1398914#L55)9 formulae (6,911 files, 605.5MB).
Error: undefined local variable or method `core_tap' for Homebrew:Module

Hmm, not sure why that would be the case, perhaps there's some sort of caching happening? It looks like you might be using the latest master in CI, which I suspect is in inherently more fragile than checking out an official release: https://gitlab.haskell.org/haskell/cabal/-/blob/master/.gitlab/brew.sh#L6

You could pin that to a specific release for improved stability. You could also try to check out the latest release, something like this might do the trick:

git checkout $(git describe --tags `git rev-list --tags --max-count=1`)

@gMan1990
Copy link

10.15.7 (19H15)
MacBook Pro (13-inch, 2020, Four Thunderbolt 3 ports)
2 GHz 四核Intel Core i5
Tapped 3 commands and 6563 formulae (6,916 files, 605.7MB).
Error: undefined local variable or method `core_tap' for Homebrew:Module
/usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:318:in `install_core_tap_if_necessary'
/usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:115:in `output_update_report'
/usr/local/Homebrew/Library/Homebrew/cmd/update-report.rb:42:in `update_report'
/usr/local/Homebrew/Library/Homebrew/brew.rb:93:in `<main>'
Failed during: /usr/local/bin/brew update --force --quiet

@dduugg
Copy link
Sponsor Member Author

dduugg commented Mar 10, 2023

@gMan1990 I'm sorry you're having this issue. What does brew --version output?

@gMan1990
Copy link

@dduugg

Homebrew 4.0.5
Homebrew/homebrew-core (git revision 0f4afdec394; last commit 2023-03-10)

Darwin edydeMacBook-Pro.local 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64

@dduugg
Copy link
Sponsor Member Author

dduugg commented Mar 10, 2023

Oh, this fix didn't make it into the latest release 🤦
Let me see if someone can cut a new release for you.

@dduugg
Copy link
Sponsor Member Author

dduugg commented Mar 11, 2023

Homebrew version 4.0.6 was just released, which incorporates this patch.

@github-actions github-actions bot added the outdated PR was locked due to age label Apr 11, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 11, 2023
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

6 participants