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

Bug in brew cleanup <formula> #4856

Closed
5 tasks done
xu-cheng opened this issue Sep 7, 2018 · 3 comments
Closed
5 tasks done

Bug in brew cleanup <formula> #4856

xu-cheng opened this issue Sep 7, 2018 · 3 comments
Assignees
Labels
outdated PR was locked due to age

Comments

@xu-cheng
Copy link
Member

xu-cheng commented Sep 7, 2018

Please note 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.

  • are reporting a bug others will be able to reproduce and not asking a question. If you're not sure or want to ask a question do so on our Discourse: https://discourse.brew.sh
  • ran a brew command and reproduced the problem with multiple formulae? If it's a problem with a single, official formula (not cask) please file this issue at Homebrew/homebrew-core: https://github.com/Homebrew/homebrew-core/issues/new/choose. If it's a brew cask problem please file this issue at https://github.com/Homebrew/homebrew-cask/issues/new/choose. If it's a tap (e.g. Homebrew/homebrew-php) problem please file this issue at the tap.
  • ran brew update and can still reproduce the problem?
  • ran brew doctor, fixed all issues and can still reproduce the problem?
  • ran brew config and brew doctor and included their output with your issue?

When I run brew upgrade neovim --fetch-HEAD && brew cleanup neovim, I found that the cleanup step fails to cleanup the old version of the neovim.

In fact, brew cleanup <formula> will fail whenever the formula is a HEAD/devel spec, or other corner cases. The culprit comes from:

Formula[arg]

There should be some formula resovling logic similar to ARGV.resovled_formulae.

if name.include?("/") || File.exist?(name)
f = Formulary.factory(name, spec)
if f.any_version_installed?
tab = Tab.for_formula(f)
resolved_spec = spec(nil) || tab.spec
f.active_spec = resolved_spec if f.send(resolved_spec)
f.build = tab
if f.head? && tab.tabfile
k = Keg.new(tab.tabfile.parent)
f.version.update_commit(k.version.version.commit) if k.version.head?
end
end
else
rack = Formulary.to_rack(name)
alias_path = Formulary.factory(name).alias_path
f = Formulary.from_rack(rack, spec(nil), alias_path: alias_path)
end
# If this formula was installed with an alias that has since changed,
# then it was specified explicitly in ARGV. (Using the alias would
# instead have found the new formula.)
#
# Because of this, the user is referring to this specific formula,
# not any formula targetted by the same alias, so in this context
# the formula shouldn't be considered outdated if the alias used to
# install it has changed.
f.follow_installed_alias = false
f

$ brew config
HOMEBREW_VERSION: 1.7.3-77-ga2f5355
ORIGIN: https://github.com/Homebrew/brew
HEAD: a2f5355ca8d9dea11542cfcc7b64d09d3dc9e333
Last commit: 69 minutes ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 6e742cd0efbb32dd6539c661adee4bf636f77146
Core tap last commit: 2 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEVELOPER: true
HOMEBREW_GIT: git
HOMEBREW_GITHUB_API_TOKEN: set
HOMEBREW_NO_ANALYTICS: true
HOMEBREW_NO_AUTO_UPDATE: true
HOMEBREW_SANDBOX: true
CPU: octa-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 9.1 build 902
Git: 2.18.0 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 10.0.2
macOS: 10.13.6-x86_64
CLT: 9.4.1.0.1.1528165917
Xcode: 9.4.1
XQuartz: N/A
@MikeMcQuaid
Copy link
Member

@xu-cheng Is this a regression e.g. can you reproduce this with 1.7.0 or 1.6.0? Thanks!

@xu-cheng
Copy link
Member Author

xu-cheng commented Sep 7, 2018

It is a regression since 03b93da

@MikeMcQuaid
Copy link
Member

@xu-cheng Thanks for checking!

@ghost ghost added the in progress Maintainers are working on this label Sep 11, 2018
@ghost ghost removed the in progress Maintainers are working on this label Sep 12, 2018
@lock lock bot added the outdated PR was locked due to age label Oct 12, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Oct 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

3 participants