Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
41.64k stars 9.79k forks source link

Error: undefined local variable or method `formulae_to_install' for Homebrew:Module #7908

Closed tompave closed 4 years ago

tompave commented 4 years ago

What you were trying to do (and why)

Trying to update some outdated formulas. Just business as usual system maintenance.

What happened (include command output)

As I normally do, I ran brew update followed by brew outdated to see what was available for an update. Then I ran brew upgrade elixir go imagemagick node. The upgrade process started as normal and then terminated with an error (exit code != 0). It seemed a bug in HomeBrew's code.

Command output

$ brew update

Updated Homebrew from 505c1e724 to ed8c2616c.
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
elixir ✔                    eslint                      jhipster                    n                           scons
imagemagick ✔               evince                      juju                        neatvi                      simple-scan
python ✔                    falcon                      kitchen-sync                node-build                  suite-sparse
aliyun-cli                  fastlane                    lc0                         odpi                        tarantool
arduino-cli                 fdupes                      libgusb                     opencoarrays                tnftpd
atomicparsley               flowgrind                   libmpdclient                osm2pgsql                   ungit
balena-cli                  glooctl                     librsvg                     ott                         virustotal-cli
bettercap                   gor                         libuv                       pc6001vx                    vulkan-headers
cdargs                      gowsdl                      libvorbis                   pnpm                        xclogparser
circleci                    html2text                   liquibase                   publish                     xmlrpc-c
deno                        imagemagick@6               mafft                       pwntools                    zoxide
diffoscope                  include-what-you-use        mikutter                    remake
dvc                         ios-webkit-debug-proxy      mill                        rtorrent
dxpy                        ipython                     mksh                        scipy
==> Updated Casks
baidunetdisk           eddie                  keepingyouawake        netron                 resolume-arena         superproductivity
bitwig-studio          electerm               kui                    onedrive               riot                   thedesk
chromium               electrum               lifesize               osxfuse                screen                 tiger-trade
chrysalis              endurance              lightproxy             qownnotes              sejda-pdf              timing
codeexpander           exodus                 lmms                   quicken                sensei                 wickrme
dashlane               fedora-media-writer    loaf                   raven-reader           sqlpro-for-mssql
dbschema               gloomhaven-helper      loom                   refined-github-safari  sqlpro-studio
detectx-swift          hex-fiend              meteorologist          rekordbox              stats

$ brew outdated
# .......

$ brew upgrade elixir go imagemagick node

==> Upgrading 4 outdated packages:
elixir 1.10.3 -> 1.10.4
go 1.14.2_1 -> 1.14.4
imagemagick 7.0.10-22 -> 7.0.10-23
node 14.2.0 -> 14.5.0
==> Upgrading elixir 1.10.3 -> 1.10.4
==> Downloading https://homebrew.bintray.com/bottles/elixir-1.10.4.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/ed/ed5f1be4059b41113c35f0a3ae1f01ae5042b143869d22457428507c4a976812?__gda__=exp=1593960269~hm
######################################################################## 100.0%
==> Pouring elixir-1.10.4.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/elixir/1.10.4: 430 files, 5.9MB
Removing: /usr/local/Cellar/elixir/1.10.3... (430 files, 5.9MB)
Removing: /Users/Tom/Library/Caches/Homebrew/elixir--1.10.3.catalina.bottle.tar.gz... (4.2MB)
==> Upgrading go 1.14.2_1 -> 1.14.4
==> Downloading https://homebrew.bintray.com/bottles/go-1.14.4.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/93/935214ab166d8da148af812614545a25778e4ee11c2ea5cfd332bff72ec4046e?__gda__=exp=1593960272~hm
######################################################################## 100.0%
==> Pouring go-1.14.4.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/go/1.14.4: 9,443 files, 424.7MB
Removing: /usr/local/Cellar/go/1.14.2_1... (9,440 files, 424.4MB)
==> Upgrading imagemagick 7.0.10-22 -> 7.0.10-23
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.32.3.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/98/98f798c4a62c9db46cc6ac82c499a0a1b8016dfebdfaa54eb4bf5c95a90117b0?__gda__=exp=1593960307~hm
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/imagemagick-7.0.10-23.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/bf/bf19ce6c826be9ab5a42d4e02b74d2f6cd8f5d9402276dae5428ac3c1dc08c6d?__gda__=exp=1593960308~hm
######################################################################## 100.0%
==> Installing dependencies for imagemagick: sqlite
==> Installing imagemagick dependency: sqlite
==> Pouring sqlite-3.32.3.catalina.bottle.tar.gz
==> Caveats
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have sqlite first in your PATH run:
  echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.profile

For compilers to find sqlite you may need to set:
  export LDFLAGS="-L/usr/local/opt/sqlite/lib"
  export CPPFLAGS="-I/usr/local/opt/sqlite/include"

For pkg-config to find sqlite you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/sqlite/3.32.3: 11 files, 4MB
==> Installing imagemagick
==> Pouring imagemagick-7.0.10-23.catalina.bottle.tar.gz
🍺  /usr/local/Cellar/imagemagick/7.0.10-23: 1,497 files, 25.6MB
Removing: /usr/local/Cellar/imagemagick/7.0.10-22... (1,497 files, 25.6MB)
Removing: /Users/Tom/Library/Caches/Homebrew/imagemagick--7.0.10-22.catalina.bottle.tar.gz... (9.9MB)
==> Upgrading node 14.2.0 -> 14.5.0
==> Downloading https://homebrew.bintray.com/bottles/icu4c-67.1.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/2d/2d1e91b5127f66e7941790c004817c94c892725c88f84f1e4c37297fcbc0c72f?__gda__=exp=1593960317~hm
######################################################################## 100.0%
==> Downloading https://homebrew.bintray.com/bottles/node-14.5.0.catalina.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/91/91096144949902e76d46a3c0cfa26f5f55665da838f77ac96c58c416940d28d0?__gda__=exp=1593960319~hm
######################################################################## 100.0%
==> Installing dependencies for node: icu4c
==> Installing node dependency: icu4c
==> Pouring icu4c-67.1.catalina.bottle.tar.gz
==> Caveats
icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).

If you need to have icu4c first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.profile
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.profile

For compilers to find icu4c you may need to set:
  export LDFLAGS="-L/usr/local/opt/icu4c/lib"
  export CPPFLAGS="-I/usr/local/opt/icu4c/include"

For pkg-config to find icu4c you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"

==> Summary
🍺  /usr/local/Cellar/icu4c/67.1: 258 files, 71.2MB
==> Installing node
==> Pouring node-14.5.0.catalina.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/node/14.5.0: 4,659 files, 61.0MB
Removing: /usr/local/Cellar/node/14.2.0... (4,659 files, 60.8MB)
==> Upgrading 1 dependent:
python 3.7.7 -> 3.7.8
==> Upgrading python 3.7.7 -> 3.7.8
==> Downloading https://homebrew.bintray.com/bottles/python-3.7.8.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/f7fb660ba03f202d739f38ded3ac5952569103855d8a8e9aa1a7bfff764bdfc2?response-content-
######################################################################## 100.0%
==> Pouring python-3.7.8.catalina.bottle.tar.gz
==> /usr/local/Cellar/python/3.7.8/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python
==> /usr/local/Cellar/python/3.7.8/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python
==> /usr/local/Cellar/python/3.7.8/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python
==> Caveats
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
  /usr/local/opt/python/libexec/bin

You can install Python packages with
  pip3 install 
They will install into the site-package directory
  /usr/local/lib/python3.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺  /usr/local/Cellar/python/3.7.8: 4,007 files, 61.4MB
Removing: /usr/local/Cellar/python/3.7.7... (4,006 files, 61.0MB)
Removing: /Users/Tom/Library/Caches/Homebrew/python--3.7.7.mojave.bottle.tar.gz... (14.9MB)
==> Checking for dependents of upgraded formulae...
Error: undefined local variable or method `formulae_to_install' for Homebrew:Module
Please report this issue:
  https://docs.brew.sh/Troubleshooting
/usr/local/Homebrew/Library/Homebrew/upgrade.rb:164:in `block in check_installed_dependents'
/usr/local/Homebrew/Library/Homebrew/cache_store.rb:17:in `use'
/usr/local/Homebrew/Library/Homebrew/upgrade.rb:163:in `check_installed_dependents'
/usr/local/Homebrew/Library/Homebrew/cmd/upgrade.rb:114:in `upgrade'
/usr/local/Homebrew/Library/Homebrew/brew.rb:111:in `
'

What you expected to happen

I expected the brew upgrade command to terminate successfully, as it usually does.

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

I've tried to reproduce the issue. I haven't been able to, but I think it's because it only happens when upgrading some specific formulas. Looking at the error message, it seems to originate from a bad reference introduced in this commit: https://github.com/Homebrew/brew/commit/2c133a3d45366a503c99a02e7e255e4387e8bff7#diff-2cfb89cd16b5d61e1c8b256f9b28c713R164

Output of brew config and brew doctor commands

$ brew config

HOMEBREW_VERSION: 2.4.3-53-ged8c261
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: ed8c2616ca9305a8fc120103a129afdd5e659760
Last commit: 8 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: bc53daee964234f1d06e147668825c0debd68c77
Core tap last commit: 45 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DISPLAY: /private/tmp/com.apple.launchd.sPUGWzUy7Y/org.macosforge.xquartz:0
HOMEBREW_MAKE_JOBS: 8
CPU: octa-core 64-bit ivybridge
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
Clang: 11.0 build 1103
Git: 2.27.0 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 10.15.5-x86_64
CLT: 1103.0.32.62
Xcode: N/A
XQuartz: 2.7.11 => /opt/X11

brew doctor is fine.

Bo98 commented 4 years ago

Fixed in #7903.