Homebrew / homebrew-cask

🍻 A CLI workflow for the administration of macOS applications distributed as binaries
https://brew.sh
BSD 2-Clause "Simplified" License
20.84k stars 10.67k forks source link

Bug report: `info` of outdated cask raises #23762

Closed wfdd closed 8 years ago

wfdd commented 8 years ago

brew cask info atom errors with No such file or directory - /usr/local/Caskroom/atom/1.9.8. Looking inside /usr/local/Caskroom/atom, I appear to have version 1.9.7 installed. I moved another, unrelated cask's inner folder to a different name, ran brew cask info other_cask and had the same error pop up.

Output of `brew cask info atom --verbose` ``` Error: No such file or directory - /usr/local/Caskroom/atom/1.9.8 Most likely, this means you have an outdated version of Homebrew-Cask. Please run: brew uninstall --force brew-cask; brew untap phinze/cask; brew untap caskroom/cask; brew update; brew cleanup; brew cask cleanup If this doesn’t fix the problem, please report this bug: https://github.com/caskroom/homebrew-cask#reporting-bugs /usr/local/Library/Homebrew/extend/pathname.rb:50:in `lstat' /usr/local/Library/Homebrew/extend/pathname.rb:50:in `lstat' /usr/local/Library/Homebrew/extend/pathname.rb:50:in `compute_disk_usage' /usr/local/Library/Homebrew/extend/pathname.rb:21:in `abv' /usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli/info.rb:19:in `info' /usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli/info.rb:8:in `block in run' /usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli/info.rb:5:in `each' /usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli/info.rb:5:in `run' /usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli.rb:108:in `run_command' /usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli.rb:146:in `process' /usr/local/Library/Taps/caskroom/homebrew-cask/cmd/brew-cask.rb:23:in `' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' /usr/local/Library/Homebrew/brew.rb:22:in `require?' /usr/local/Library/Homebrew/brew.rb:93:in `
' Error: Kernel.exit ```
Output of `brew doctor`
Output of `brew cask doctor` ``` ==> macOS Release: 10.11.6 ==> Hardware Architecture: intel-64 ==> Ruby Version: 2.0.0-p648 ==> Ruby Path: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby ==> Homebrew Version: Homebrew 0.9.9 (git revision b40b0; last commit 2016-08-13) Homebrew/homebrew-core (git revision 35ae; last commit 2016-08-13) ==> Homebrew Executable Path: /usr/local/bin/brew ==> Homebrew Cellar Path: /usr/local/Cellar ==> Homebrew Repository Path: /usr/local ==> Homebrew Origin: https://github.com/Homebrew/brew ==> Homebrew-Cask Version: 0.60.0 (git revision 96c1; last commit 5 hours ago) ==> Homebrew-Cask Install Location: ==> Homebrew-Cask Staging Location: /usr/local/Caskroom ==> Homebrew-Cask Cached Downloads: /Users/.../Library/Caches/Homebrew/Cask 0 files, 0B ==> Homebrew-Cask Default Tap Path: /usr/local/Library/Taps/caskroom/homebrew-cask ==> Homebrew-Cask Alternate Cask Taps: ==> Homebrew-Cask Default Tap Cask Count: 3257 ==> Contents of $LOAD_PATH: /usr/local/Library/Taps/caskroom/homebrew-cask/lib /usr/local/Library/Homebrew /Library/Ruby/Site/2.0.0 /Library/Ruby/Site/2.0.0/x86_64-darwin15 /Library/Ruby/Site/2.0.0/universal-darwin15 /Library/Ruby/Site /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/x86_64-darwin15 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/universal-darwin15 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/x86_64-darwin15 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15 ==> Contents of $RUBYLIB Environment Variable: ==> Contents of $RUBYOPT Environment Variable: ==> Contents of $RUBYPATH Environment Variable: ==> Contents of $RBENV_VERSION Environment Variable: ==> Contents of $CHRUBY_VERSION Environment Variable: ==> Contents of $GEM_HOME Environment Variable: ==> Contents of $GEM_PATH Environment Variable: ==> Contents of $BUNDLE_PATH Environment Variable: ==> Contents of $PATH Environment Variable: PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Library/Taps/caskroom/homebrew-cask/cmd:/usr/local/Library/Taps/homebrew/homebrew-services/cmd:/usr/local/Library/Homebrew/shims/scm" ==> Contents of $SHELL Environment Variable: SHELL="/usr/local/bin/fish" ==> Contents of Locale Environment Variables: LANG="en_GB.UTF-8" ==> Running As Privileged User: No ```
wfdd commented 8 years ago

As an aside, the output or brew cask doctor has my OS X username under the 'Homebrew-Cask Cached Downloads' heading. A less astute copy-paster might unwittingly reveal their name.

sanyer commented 8 years ago

Also, error message shouldn't suggest brew untap phinze/cask command. As of https://github.com/caskroom/homebrew-cask/issues/16094#issuecomment-167276090

jawshooah commented 8 years ago

@sanyer That comment instructs you not to tap phinze/cask, not untap it. Some folks have been using Homebrew Cask since the days when @phinze ran the show, and they may have an old tap lying around causing bugs. The suggestion is still relevant to those users.

sanyer commented 8 years ago

@jawshooah oh, ok, makes sense. Thing is, that it confused me and I started looking for this tap, ended up tapping it :-)

reitermarkus commented 8 years ago

Fixed in https://github.com/caskroom/homebrew-cask/pull/23782.

wickles commented 8 years ago

Same error still after updated with merge from https://github.com/caskroom/homebrew-cask/pull/23782. Were there some changes made that might cause errors for previously installed older casks, that might not occur for outdated casks installed following this merge?

reitermarkus commented 8 years ago

@wickles, what cask(s) exactly is this happening with?

wickles commented 8 years ago

All outdated casks that I've tried.

`brew cask info calibre` ``` alex@Alex-MBA-2013:~$ brew cask info calibre calibre: 2.64.0 https://calibre-ebook.com/ Error: No such file or directory - /opt/homebrew-cask/Caskroom/calibre/2.56.0 Most likely, this means you have an outdated version of Homebrew-Cask. Please run: brew uninstall --force brew-cask; brew untap phinze/cask; brew untap caskroom/cask; brew update; brew cleanup; brew cask cleanup If this doesn’t fix the problem, please report this bug: https://github.com/caskroom/homebrew-cask#reporting-bugs /usr/local/Library/Homebrew/extend/pathname.rb:50:in `lstat' /usr/local/Library/Homebrew/extend/pathname.rb:50:in `lstat' /usr/local/Library/Homebrew/extend/pathname.rb:50:in `compute_disk_usage' /usr/local/Library/Homebrew/extend/pathname.rb:21:in `abv' /usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli/info.rb:35:in `block in installation_info' /usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli/info.rb:33:in `each' /usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli/info.rb:33:in `installation_info' /usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli/info.rb:20:in `info' /usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli/info.rb:9:in `block in run' /usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli/info.rb:5:in `each' /usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli/info.rb:5:in `run' /usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli.rb:108:in `run_command' /usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli.rb:146:in `process' /usr/local/Library/Taps/caskroom/homebrew-cask/cmd/brew-cask.rb:23:in `' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require' /usr/local/Library/Homebrew/brew.rb:22:in `require?' /usr/local/Library/Homebrew/brew.rb:93:in `
' ```
`brew doctor` ``` alex@Alex-MBA-2013:~$ 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 and just ignore them. Thanks! Warning: Some directories in /usr/local/share/man aren't writable. This can happen if you "sudo make install" software that isn't managed by Homebrew. If a brew tries to add locale information to one of these directories, then the install will fail during the link step. You should `sudo chown -R $(whoami)` them: /usr/local/share/man/de /usr/local/share/man/de/man1 Warning: Anaconda is known to frequently break Homebrew builds, including Vim and MacVim, due to bundling many duplicates of system and Homebrew-available tools. If you encounter a build failure please temporarily remove Anaconda from your $PATH and attempt the build again prior to reporting the failure to us. 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 what 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: /Users/alex/anaconda/bin/curl-config /Users/alex/anaconda/bin/freetype-config /Users/alex/anaconda/bin/libdynd-config /Users/alex/anaconda/bin/libpng-config /Users/alex/anaconda/bin/libpng16-config /Users/alex/anaconda/bin/python-config /Users/alex/anaconda/bin/python2-config /Users/alex/anaconda/bin/python2.7-config /Users/alex/anaconda/bin/xml2-config /Users/alex/anaconda/bin/xslt-config /opt/local/bin/apr-1-config /opt/local/bin/apu-1-config /opt/local/bin/curl-config /opt/local/bin/freetype-config /opt/local/bin/gdlib-config /opt/local/bin/gsl-config /opt/local/bin/gts-config /opt/local/bin/jemalloc-config /opt/local/bin/krb5-config /opt/local/bin/libpng-config /opt/local/bin/libpng16-config /opt/local/bin/Magick++-config /opt/local/bin/Magick-config /opt/local/bin/MagickCore-config /opt/local/bin/MagickWand-config /opt/local/bin/ncurses6-config /opt/local/bin/ncursesw6-config /opt/local/bin/netpbm-config /opt/local/bin/pcap-config /opt/local/bin/pcre-config /opt/local/bin/pkg-config /opt/local/bin/python-config /opt/local/bin/python2.7-config /opt/local/bin/python3.5-config /opt/local/bin/python3.5m-config /opt/local/bin/root-config /opt/local/bin/sdl-config /opt/local/bin/Wand-config /opt/local/bin/xml2-config /opt/local/bin/xslt-config /usr/local/pspdev/bin/psp-config Warning: Python is installed at /Library/Frameworks/Python.framework Homebrew only supports building against the System-provided Python or a brewed Python. In particular, Pythons installed to /Library can interfere with other software installs. Warning: You have MacPorts or Fink installed: /opt/local/bin/port This can cause trouble. You don't have to uninstall them, but you may want to temporarily move them out of the way, e.g. sudo mv /opt/local ~/macports 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/libusb-0.1.4.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/usb.h Warning: Unbrewed .la files 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 .la files: /usr/local/lib/libusb.la Warning: Unbrewed .pc files were found in /usr/local/lib/pkgconfig. If you didn't put them there on purpose they could cause problems when building Homebrew formulae, and may need to be deleted. Unexpected .pc files: /usr/local/lib/pkgconfig/libusb.pc Warning: Unbrewed static libraries 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 static libraries: /usr/local/lib/libusb.a 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: You have a non-Homebrew 'pkg-config' in your PATH: /opt/local/bin/pkg-config `./configure` may have problems finding brew-installed packages using this other pkg-config. Warning: Broken symlinks were found. Remove them with `brew prune`: /usr/local/bin/unoinfo Warning: Some installed formula are missing dependencies. You should `brew install` the missing dependencies: brew install libusb libusb-compat Run `brew missing` for more details. ```
`brew cask doctor` ``` alex@Alex-MBA-2013:~$ brew cask doctor ==> macOS Release: 10.11.6 ==> Hardware Architecture: intel-64 ==> Ruby Version: 2.0.0-p648 ==> Ruby Path: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby ==> Homebrew Version: Homebrew 0.9.9 (git revision 4309; last commit 2016-08-14) Homebrew/homebrew-core (git revision c4eb4; last commit 2016-08-14) ==> Homebrew Executable Path: /usr/local/bin/brew ==> Homebrew Cellar Path: /usr/local/Cellar ==> Homebrew Repository Path: /usr/local ==> Homebrew Origin: https://github.com/Homebrew/brew.git ==> Homebrew-Cask Version: 0.60.0 (git revision f2ba; last commit 31 minutes ago) ==> Homebrew-Cask Install Location: ==> Homebrew-Cask Staging Location: /opt/homebrew-cask/Caskroom ==> Homebrew-Cask Cached Downloads: /Users/alex/Library/Caches/Homebrew/Cask 2 files, 10M (warning: run "brew cask cleanup") ==> Homebrew-Cask Default Tap Path: /usr/local/Library/Taps/caskroom/homebrew-cask ==> Homebrew-Cask Alternate Cask Taps: ==> Homebrew-Cask Default Tap Cask Count: 3259 ==> Contents of $LOAD_PATH: /usr/local/Library/Taps/caskroom/homebrew-cask/lib /usr/local/Library/Homebrew /Library/Ruby/Site/2.0.0 /Library/Ruby/Site/2.0.0/x86_64-darwin15 /Library/Ruby/Site/2.0.0/universal-darwin15 /Library/Ruby/Site /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/x86_64-darwin15 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/universal-darwin15 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/x86_64-darwin15 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15 ==> Contents of $RUBYLIB Environment Variable: ==> Contents of $RUBYOPT Environment Variable: ==> Contents of $RUBYPATH Environment Variable: ==> Contents of $RBENV_VERSION Environment Variable: ==> Contents of $CHRUBY_VERSION Environment Variable: ==> Contents of $GEM_HOME Environment Variable: ==> Contents of $GEM_PATH Environment Variable: ==> Contents of $BUNDLE_PATH Environment Variable: ==> Contents of $PATH Environment Variable: PATH="/Users/alex/anaconda/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/local/MacGPG2/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Library/TeX/texbin:/usr/local/pspdev/bin:/usr/local/Library/Taps/caskroom/homebrew-cask/cmd:/usr/local/Library/Homebrew/shims/scm" ==> Contents of $SHELL Environment Variable: SHELL="/opt/local/bin/bash" ==> Contents of Locale Environment Variables: LANG="en_US.UTF-8" ==> Running As Privileged User: No ```
wickles commented 8 years ago

Note that I do have the deprecated Caskroom path:

==> Homebrew-Cask Staging Location:
/opt/homebrew-cask/Caskroom

Maybe that's causing problems?

reitermarkus commented 8 years ago

Is it working for current casks? If it is, the Caskroom path is unlikely to be the issue.

wickles commented 8 years ago

Yes. brew cask info works for casks that I do not have installed and for casks that were previously installed but up to date.

wfdd commented 8 years ago

That's more a lack of fault tolerance than an actual bug. The new info lists all prior versions you've got installed; it derives these from the hidden 'metadata' folder. You appear to have deleted the cask version folders but retained their corresponding metadata entries. Try running cd /opt/homebrew-cask/Caskroom/calibre; ls .metadata | xargs mkdir and then brew cask info calibre again.

reitermarkus commented 8 years ago

@wfdd, that was also the only thing I could think of, as there are some casks that move the entire versioned staged_path as a suite (e. g. displaycal).

wfdd commented 8 years ago

Both brew cask info displaycal and brew cask uninstall displaycal fail after installation, so this should be treated as a bug then.

reitermarkus commented 8 years ago

@wfdd, brew cask uninstall displaycal is working for me, so this might be a separate issue.

ghuff07 commented 8 years ago

I experienced this issue with casks I had previously installed and updated. I had deleted the prior version folder under /usr/local/Caskroom/(cask)/(old-version) but not the corresponding version folder in .metadata (/usr/local/Caskroom/(cask)/.metadata/(old-version)). Once I also deleted the prior version folder in .metadata everything is working as expected.

wickles commented 8 years ago

Ok, info works appropriately now since https://github.com/caskroom/homebrew-cask/pull/23808. FWIW I was using just brew cask install --force to upgrade outdated casks, which I was under the impression was a suggested approach.

Also, this change breaks my cask-outdated alias:

alias cask-outdated='brew cask list | xargs brew cask info | grep -i -B 3 '\''Not installed'\'''

Is there a new suggested way to check for outdated casks?

jawshooah commented 8 years ago

There is not yet an officially supported way to check for outdated Casks or to upgrade Casks.

Speaking as a user and not as a maintainer, however, check out brew-cask-upgrade.

reitermarkus commented 8 years ago

Well, uninstall should be working now for old versions. So I would suggest

brew cask uninstall {{cask}}
brew cask install {{cask}}

to upgrade, instead of brew cask install --force.

wickles commented 8 years ago

Would it make sense to add a line to info to show when a cask is installed but not current? Analogously to Not installed. For example:

mono-mdk: 4.4.2.11
http://mono-project.com/
Not up-to-date
/opt/homebrew-cask/Caskroom/mono-mdk/4.2.1.102 (does not exist)
/opt/homebrew-cask/Caskroom/mono-mdk/4.4.0.142 (295.0M)
/opt/homebrew-cask/Caskroom/mono-mdk/4.4.1.0 (302.6M)
From: https://github.com/caskroom/homebrew-cask/blob/master/Casks/mono-mdk.rb
==> Name
Mono
==> Artifacts
MonoFramework-MDK-4.4.2.11.macos10.xamarin.universal.pkg (pkg)