Skip to content

Unable to install formula with "outdated pinned dependency" #6103

@NickLaMuro

Description

@NickLaMuro

Please note that we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

Note: The issues reported by brew doctor seemed benign and based on a bit of "puts debugging", so I don't think they are related to the issue at hand, but that output and brew config are provided below for posterity.

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: You have the following deprecated, official taps tapped:
  Homebrew/homebrew-dupes
Untap them with `brew untap`.

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
  /usr/local/lib/libwkhtmltox.0.12.3.dylib

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/wkhtmltox/image.h
  /usr/local/include/wkhtmltox/pdf.h

Warning: You have uncommitted modifications to Homebrew.
If this is a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
  cd /usr/local/Homebrew/Library && git stash && git clean -d -f

Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so:
  echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile

Warning: Some installed formulae are missing dependencies.
You should `brew install` the missing dependencies:
	brew install adns gnutls gts ilmbase jasper libassuan libde265 libgcrypt
               libgpg-error libheif libksba libomp libtasn1 libunistring libusb
               little-cms2 netpbm nettle npth openexr openjpeg p11-kit pinentry
               qrencode shared-mime-info unbound x265

Run `brew missing` for more details.
brew config output
HOMEBREW_VERSION: 2.1.2-1-g9934f00-dirty
ORIGIN: https://github.com/Homebrew/brew
HEAD: 9934f0086bcefc7cb645cac9d4006943648646e1
Last commit: 9 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: c7ec7b1843dd249a26e6890f487a443b976810b1
Core tap last commit: 7 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_NO_ANALYTICS_THIS_RUN: 1
CPU: octa-core 64-bit haswell
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 10.0 build 1001
Git: 2.20.1 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 1.8.0_102
macOS: 10.14.4-x86_64
CLT: 10.2.1.0.1.1554506761
Xcode: N/A
CLT headers: 10.2.1.0.1.1554506761

What you were trying to do (and why)

Install the h2o package with a pinned readline package (pinned to 8.0.0).

Extra info/rational about pinning readline (aka: "the why")

Personally, I have found that allowing readline to be unpinned will cause ruby-install/chruby to "bork" other rubies when a new ruby is installed. Details in the PR that I opened up in an attempt to address that (brew related):

postmodern/ruby-install#340

To summarize, by forcing an upgrade to all dependent packages (readline being one of them) on install of a new ruby, it will create a new directory and location for it's .dll file that ruby compiles against, and so previous versions that depended on that location of the .dll will now fail to execute functions that rely on readline such as irb (example output show in the above PR).

Pinning a package was the simplest workaround to that problem while the above PR is outstanding.

Steps below are going to recreate with sphinx-doc as it is a nested dependency from above, and makes for a smaller dependency stack to digest (also shows the issue isn't with a single formula).

Dependency "graph" for h2o (down below for illustration):

h2o
  cmake
    sphinx-doc
      python
        pkg-config
        gdbm
        openssl
        readline
        sqlite
          readline
        xz
  pkg-config
  openssl

What happened (include command output)

brew err'd out and said to "brew unpin readline" and to reinstall, as sphinx-doc required the latest version to install properly:

Command output
$ brew install sphinx-doc
Error: You must `brew unpin readline` as installing sphinx-doc requires the latest version of pinned dependencies

What you expected to happen

Install the package. readline should not require an update for this package to function.

Specifically, it seems like check that causes the above error was added here: #864

Which was solving the inverse (almost) of what I am dealing with. In the case of the reported issue it is attempting to solve, the user bumped the pinned package in question, and then it was unable to find the path necessary when installing a dependent package that depended on the pinned one.

In my case, it seems like homebrew is looking for a different version then what I have pinned, 8.0.0_1 versus 8.0.0 respectively, and so this fails the Formula#installed? check. In my case, I have 8.0.0 pinned, and to my knowledege it hasn't been upgraded, and instead is looking for 8.0.0_1 for some reason:

$ brew info readline
$ brew info readline
readline: stable 8.0.0 (bottled) [pinned at 8.0.0, keg-only]
Library for command-line editing
https://tiswww.case.edu/php/chet/readline/rltop.html
/usr/local/Cellar/readline/8.0.0 (48 files, 1.5MB)
  Poured from bottle on 2019-02-18 at 11:42:36
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/readline.rb
==> Caveats
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.

==> Analytics
install: 456,582 (30 days), 1,283,263 (90 days), 4,154,455 (365 days)
install_on_request: 48,806 (30 days), 135,047 (90 days), 412,783 (365 days)
build_error: 0 (30 days)

I have some puts debugging prior to opening this issue, which I am providing the output to that below, along with the diff of the changes I made to brew:

brew install sphinx-doc (with debugging)
$ brew install sphinx-doc
Dependencies...
pkg-config
  installed?       true
    dir:           "/usr/local/opt/pkg-config"
    dir?           true
  missing_options? false
gdbm
  installed?       true
    dir:           "/usr/local/opt/gdbm"
    dir?           true
  missing_options? false
openssl
  installed?       true
    dir:           "/usr/local/opt/openssl"
    dir?           true
  missing_options? false
readline
  installed?       false
    dir:           "/usr/local/Cellar/readline/8.0.0_1"
    dir?           false
  missing_options? false
sqlite
  installed?       false
    dir:           "/usr/local/Cellar/sqlite/3.28.0"
    dir?           false
  missing_options? false
xz
  installed?       true
    dir:           "/usr/local/opt/xz"
    dir?           true
  missing_options? false
python
  installed?       false
    dir:           "/usr/local/Cellar/python/3.7.3"
    dir?           false
  missing_options? false
Error: You must `brew unpin readline` as installing sphinx-doc requires the latest version of pinned dependencies
git diff of Homebrew dir
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index b549b762d..a85a7d8cc 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -189,7 +189,13 @@ class FormulaInstaller
       EOS
     end
 
+    puts "Dependencies..."
     pinned_unsatisfied_deps = recursive_deps.select do |dep|
+      puts dep.to_formula.full_name
+      puts "  installed?       #{dep.to_formula.installed?.inspect}"
+      puts "    dir:           #{dep.to_formula.installed_prefix.to_s.inspect}"
+      puts "    dir?           #{dep.to_formula.installed_prefix.directory?.inspect}"
+      puts "  missing_options? #{(!dep.missing_options(inherited_options_for(dep)).empty?).inspect}"
       dep.to_formula.pinned? && !dep.satisfied?(inherited_options_for(dep))
     end

My guess (without knowing how the dependencies are determined prior to checking if they exist) is that brew is somehow determining that readline 8.0.0_1 is required for this install, when I already should have it satisfied with readline 8.0.0.

My work around at the moment was to just brew edit cmake and remove the depends_on "sphinx-doc" line, brew install h2o and then undo the change. Allows the reproduction steps to work, and me to continue on my way. I will attempt to figure out how Homebrew determines the dependencies in the first place some other time, but wanted to open this to make the maintainers aware of the issue.

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

I will update these steps in the future with a more accurate brew SHA for the installation of readline, but for the time being I am just leaving it as ??? for step three...

  1. Checkout 1c2fb33043 for homebrew-core
  2. $ brew install readline (should install the 8.0.0 version)
  3. $ brew pin readline
  4. Checkout master for homebrew-core.
  5. $ brew install sphinx-doc 💥

Update: Looking at the history for homebrew-core/Formula/readline.rb, it looks like at ed947f87 it was updated to 8.0.0_1 by the bot 10 days ago, and it was originally at 8.0.0 at 1c2fb33043 (4 months ago). I updated the steps with the "theoretical steps" based on those commits, though I haven't reproduced them myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedPR was locked due to age

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions