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
brew upgrade
misbehaves when a formula's dependency is renamed
#1770
Comments
brew update
misbehaves when a formula's dependency is renamedbrew upgrade
misbehaves when a formula's dependency is renamed
The fix for this is probably to expand |
This is definitely an issue. Follow https://github.com/Homebrew/brew#update-bug and let me know if you can reproduce this afterwards. |
@MikeMcQuaid After following the instructions you linked, |
@cartr It's worth noting that |
For each formula to be uninstalled, find all linked kegs that were installed with that formula (even if it had a different name at the time) and unlink them. Fixes Homebrew#1770.
@cartr Did you try to |
I just ran into this bug myself with |
brew configHOMEBREW_VERSION: 1.1.6-9-g98dadd907 ORIGIN: https://github.com/Homebrew/brew HEAD: 98dadd907e31bb5f9a16bfb6aa2138b1852c4db5 Last commit: 52 minutes ago Core tap ORIGIN: https://github.com/Homebrew/homebrew-core Core tap HEAD: 1fba10615dd0c5cbac427d74a9d7d5023bd3ae27 Core tap last commit: 73 minutes ago HOMEBREW_PREFIX: /usr/local HOMEBREW_REPOSITORY: /usr/local/Homebrew HOMEBREW_CELLAR: /usr/local/Cellar HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com CPU: quad-core 64-bit haswell Homebrew Ruby: 2.0.0-p648 Clang: 8.0 build 800 Git: 2.11.0 => /usr/local/bin/git Perl: /usr/bin/perl Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/bin/python2.7 Ruby: /Users/alyssa/.rubies/ruby-2.3.3/bin/ruby Java: 1.8.0_112 macOS: 10.12.2-x86_64 Xcode: 8.2.1 CLT: 8.2.0.0.1.1480973914 X11: N/A brew doctorPlease 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! |
@alyssais Can you try to |
I can reproduce on 538028a, but not on master, so it was probably fixed somewhere in between, but if brew is auto-updated as part of brew upgrade it looks like it doesn't pick up on the fix for that run. |
@alyssais You'll also need to reset homebrew/core and homebrew/versions repos to older versions and |
Have gone to great lengths to try to reproduce this, even with the versions I was using when I saw it, but I can't 😞 |
Okay, I think I've got this: brew update
git -C "$(brew --repository)/Library/Taps/homebrew/homebrew-core" reset --hard b366b398
git -C "$(brew --repository)/Library/Taps/homebrew/homebrew-versions" reset --hard 07b7501
HOMEBREW_NO_AUTO_UPDATE=1 brew install gcc48
brew upgrade |
@MikeMcQuaid Yup, @alyssais's commands above do reproduce the problem. |
Note the gcc48 -> gcc@4.8 isn't present in the update report. |
OK so at those initial revisions, homebrew/core/gcc@4.8 and and homebrew/versions/gcc48 both exist, the rename is in the formula_renames file in core, and the migration is not in the tap_migrations file in versions. So my initial guess is that update_report is relying on the content of tap_migrations before the update rather than after. |
Nope, adding it to tap_migrations ahead of time does nothing, so quite broken indeed. |
OK, if I set core back to a revision before gcc@4.8 exists, then it works. |
If gcc48 and gcc@4.8 both exist at the time update runs, then a migration will not be performed. So as we've folded the non-core taps into homebrew/core, every time the import PR into core was merged before the deletion PR in the original tap, anyone who updated in between will not have been migrated. In most cases, the import PR and deletion PR occurred nearly simultaneously, but there were cases where they were separated by hours or days. Also, anyone who did any ill-timed updates via So the poor man's mitigation without changing any code, if you think you may have been impacted, is to run The worst case scenario is that a user has installed both the source and target. This is entirely possible because if I had If/when #2359 ships, it will also be possible for a double installation to simply be a migration that hasn't been completed yet. Also, if that PR ships, double installations will be subject to migration attempts, possibly trying to move the exact same version on top of itself. Ideally, we would also have something preventing double installations from ever happening by not allowing them to proceed, but currently there is nothing to prevent them regardless of whether the migration bug reported here gets fixed. Of course, they'll be far less likely once this is fixed, but they will still currently be possible either way. |
I think I have a fix for this in #2370. |
The expected result I suppose is at least |
What if we create a separate issue for that? This issue has nothing to do with Speaking of the issue, it happens because if there is a formula |
brew update
and retried your prior step?brew doctor
, fixed as many issues as possible and retried your prior step?Here's my
brew config
andbrew doctor
output.Summary
If a formula (that is depended on by another installed formula) is renamed,
brew update
tries to install it on top of the old one and fails during thebrew link
step.Steps to Reproduce
Run these commands:
You'll get two new formulae installed:
somepackage
(which is GNU Hello) anddependent
which depends on it. Next, run these to switch to a branch wheresomepackage
has been renamed tosomepackage4
and upgrade:Expected Result
The upgrade completes successfully, migrating
somepackage
tosomepackage4
.Actual Result
somepackage
remains installed in its original location.somepackage4
is installed but unlinked.The text was updated successfully, but these errors were encountered: