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

Dependency resolution disagreement between brew missing & brew install --only-dependencies #14121

Closed
2 tasks done
jacktose opened this issue Nov 9, 2022 · 5 comments
Closed
2 tasks done
Labels
bug Reproducible Homebrew/brew bug outdated PR was locked due to age

Comments

@jacktose
Copy link
Contributor

jacktose commented Nov 9, 2022

I don't understand in detail how brew missing or brew install --only-dependencies are supposed to work, but they can be made to apparently disagree.

I saw this happen in normal usage and then replicated it on another machine with a supported config, as you see below.

brew config output

$ brew config
HOMEBREW_VERSION: 3.6.9-23-gc33b5b2
ORIGIN: https://github.com/Homebrew/brew
HEAD: c33b5b257e45f399c93f5d362d2159edaca8d480
Last commit: 9 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 47c924656ffea421487417ecd363bd60a98900f8
Core tap last commit: 2 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /home/linuxbrew/.linuxbrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DISPLAY_INSTALL_TIMES: set
HOMEBREW_EDITOR: vim
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_MAKE_JOBS: 4
Homebrew Ruby: 2.6.8 => /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.8_1/bin/ruby
CPU: quad-core 64-bit ivybridge
Clang: N/A
Git: 2.25.1 => /bin/git
Curl: 7.68.0 => /bin/curl
Kernel: Linux 5.10.102.1-microsoft-standard-WSL2 x86_64 GNU/Linux
OS: Ubuntu 20.04.5 LTS (focal)
Host glibc: 2.31
/usr/bin/gcc: 9.4.0
/usr/bin/ruby: N/A
glibc: 2.35_1
gcc@11: N/A
gcc: 12.2.0
xorg: N/A

brew doctor output

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /home/jack/.asdf/shims/python-config
  /home/jack/.asdf/shims/python3-config
  /home/jack/.asdf/shims/python3.10-config
  /home/jack/.asdf/shims/python3.9-config

Warning: Some installed formulae are missing dependencies.
You should `brew install` the missing dependencies:
  brew install gcc@11

Run `brew missing` for more details.

Verification

  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.

What were you trying to do (and why)?

Resolve errors from brew doctor and brew missing. Understand the situation before installing.

What happened (include all command output)?

$ brew list
==> Formulae
bat       ca-certificates  gdbm   isl     libnsl              lz4        ncurses          [email protected]  six     yadm
binutils  expat            gh     krb5    libtirpc            m4         no-more-secrets  readline     sqlite  z
bison     gcc              glibc  libffi  libxcrypt           mpdecimal  [email protected]      shellcheck   unzip   zlib
bzip2     gcc@11           gmp    libmpc  [email protected]  mpfr       pipenv           shfmt        xz      zstd

$ brew missing

$ brew uses --installed gcc@11
krb5                          libnsl                        libtirpc                      unzip

$ brew uninstall gcc@11
Error: Refusing to uninstall /home/linuxbrew/.linuxbrew/Cellar/gcc@11/11.3.0
because it is required by krb5, libnsl, libtirpc and unzip, which are currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies gcc@11

$ brew uninstall --ignore-dependencies gcc@11
Uninstalling /home/linuxbrew/.linuxbrew/Cellar/gcc@11/11.3.0... (2,187 files, 347.3MB)

$ brew missing
krb5: gcc@11
libnsl: gcc@11
libtirpc: gcc@11
unzip: gcc@11

$ brew install --only-dependencies -n krb5
==> Would install 1 formula:
krb5

$ brew install --only-dependencies -n libnsl
==> Would install 1 formula:
libnsl

$ brew install --only-dependencies -n libtirpc
==> Would install 1 formula:
libtirpc

$ brew install --only-dependencies -n unzip
==> Would install 1 formula:
unzip

$ brew install --only-dependencies unzip
All dependencies for unzip are satisfied.
==> Running `brew cleanup unzip`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

$ brew missing
krb5: gcc@11
libnsl: gcc@11
libtirpc: gcc@11
unzip: gcc@11

What did you expect to happen?

If [formula] is missing a dependency, brew install --only-dependencies -n [formula] should show the dependency (and not [formula]).
brew install --only-dependencies [formula] should install the dependency.

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

# Find an installed formula that is a dependency of another:
brew uses --installed [dependency]

# Remove the dependency:
brew uninstall [dependency]

# Confirm the dependency is missing:
brew missing

# Attempt to satisfy the missing dependency:
brew install --only-dependencies [-n] [dependent]
@jacktose jacktose added the bug Reproducible Homebrew/brew bug label Nov 9, 2022
@MikeMcQuaid
Copy link
Member

This is confusing but is expected behaviour. If a formula is already installed, it can have additional detected dependencies that are not defined in the formula but are listed in the tab (INSTALL_RECEIPT.json) due to (slow) linkage checks.

@jacktose
Copy link
Contributor Author

jacktose commented Nov 9, 2022

So the only way to proceed is just what it says: brew install [dependency] (and then go manually mark it installed as dependency)?

@MikeMcQuaid
Copy link
Member

So the only way to proceed is just what it says: brew install [dependency] (and then go manually mark it installed as dependency)?

@jacktose brew reinstall unzip may resolve this.

@jacktose
Copy link
Contributor Author

It did, but not the way I thought. It didn't install gcc@11, but it did remove (only) unzip from the missing list.

$ brew reinstall unzip
==> Downloading https://ghcr.io/v2/homebrew/core/unzip/manifests/6.0_8
Already downloaded: /home/jack/.cache/Homebrew/downloads/b9a98c1a65dea38eb0bb5d9106a5758ed0ff17635811bd7f7cd6be5908c2961b--unzip-6.0_8.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/unzip/blobs/sha256:baf15e19852a0f9756e3302fa6f3866eaeccc06730c9907bffc19f32861d64bf
Already downloaded: /home/jack/.cache/Homebrew/downloads/b21864e34ef4cb82ce78fcf50f8d91e7b3525e695b095c7d006c15cd802eefbb--unzip--6.0_8.x86_64_linux.bottle.tar.gz
==> Reinstalling unzip
==> Pouring unzip--6.0_8.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/unzip/6.0_8: 16 files, 597.4KB
==> Running `brew cleanup unzip`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Installation times
unzip                     0.823 s

$ brew missing
krb5: gcc@11
libnsl: gcc@11
libtirpc: gcc@11

What's up with that? 😕

@MikeMcQuaid
Copy link
Member

@jacktose it's fixing outdated dependency lists by recalculating the linkage.

@github-actions github-actions bot added the outdated PR was locked due to age label Dec 12, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Reproducible Homebrew/brew bug outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

2 participants