-
-
Notifications
You must be signed in to change notification settings - Fork 10k
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 says [email protected] is needed by cairo and graphene, but it's not #13717
Comments
The |
It makes for a very weird user experience, to say the least… |
Yea, it does. A workaround for new is to |
@MikeMcQuaid I'm not going to make more noise about it if you still disagree, but I genuinely think this is a bug in brew that's worth trying to fix. |
@carlocab def all_runtime_dependencies (formula)
required_deps = formula.deps.select{|dep| dep.required? }
further_deps = required_deps.map{|r_dep| r_dep.to_formula.deps}.flatten.uniq.select{|dep| dep.required? and !required_deps.include?(dep) }
while further_deps != [] do
required_deps.push *further_deps
further_deps = further_deps.map{|f_dep| f_dep.to_formula.deps}.flatten.uniq.select{|dep| dep.required? and !required_deps.include?(dep) }
end
return required_deps
end |
That's not quite enough. The issue is that there is a difference between the dependencies recorded in the tab and the dependencies declared in the relevant formulae. We need to work out how to identify these differences arising and what to do about them when they do. |
Assuming that the list is correct when a formula is installed from source, how can the dependency list get out-of-date? It seems like this list is only updated/created when a formula is installed. That means that each direct dependency and it's dependencies are recorded in the tab. If a dependency changes it's dependencies in the meantime, then only it's own tab will be updated; all of the formulas that depend on it will have out-of-date dependency lists. The likelihood that a formula will have an out-of-date dependency list goes up with bottles since the tab is recorded when the bottle is built not when the bottle is installed. Is that what's going on here? |
Yes, that sounds correct. I'm just not sure how to balance the existing conservatism against some dependencies sometimes becoming stale. In particular, I'm concerned about the dependency-tree-as-declared-in-the-formula being wrong, and we definitely don't want to do the uninstall in those cases. |
Agreed 👍🏻
IMO the only issue here is the inconsistency really. If we ensure they are both 👍🏻 or 👎🏻 on the same formula: we're good here. Ideally, that would result in more shared code between the two commands so they don't drift in future. |
I think that we shouldn't be evaluating indirect dependencies when deciding which things can be uninstalled. We should only care if there is a direct dependency that is used by a formula. From what I understand only the indirect dependencies can go out-of-date. I'm pretty sure this is what naturally happens when we evaluate dependencies based on the formula description instead of the install receipt. Do we care though if the install receipt is up-to-date or is it more important to record the dependencies as they were when they were first installed? It seems like if we update a formula A that we could check for all of the formulas that depend on A and recalculate their dependencies though that sounds expensive. I'm not sure if that's a priority though it would be another way to solve this problem. To make this a bit clearer I see two possible solutions.
|
Yeah, it's not great that we have multiple algorithms in the codebase that evaluate whether a formula is an active dependency. Ideally we'd just have one that could be used in multiple circumstances. The problem is that they're not the same algorithm. Autoremove
Uninstall
|
@apainintheneck Good catch! Could they somehow use the same algorithm, even if suboptimal for one of the approaches? |
I don't see any practical way to combine these algorithms though one of the annoying things is that we run both of them during I'm in favor of just keeping the tab up-to-date at all times. This would mean recalculating the runtime dependencies portion whenever a bottle is installed or a new version of a formula is installed that other formulae depend on. What worries me most about this approach is that for a few widely used dependencies this would mean recalculating that information for many formulae at once over multiple levels of the dependency tree. That sounds expensive but we should be able to skip it whenever the dependencies don't change. |
How about if we made
and then With a bit of memoization it feels like this approach could be just as efficient. What do you think @apainintheneck? |
I'm a bit wary of recalculating dep trees without also checking linkage information (which I think we don't do because it's slow). In particular, I am concerned about situations where |
If its not feasible to recalculate dependency trees for performance reasons, maybe we should look into changing the algorithm somehow to ignore these situations. It's interesting how the
Wow, I had not considered that. Do you know how often this happens or have any examples of this problem? And correct me if I'm wrong but this linkage info doesn't seem to be recorded anywhere else in the tab. |
That could work as refactor but there are two problems. One, that is the algorithm that is currently not working correctly when the info in the tab is outdated. And, two, we'd still have to find exceptions for things like not autoremoving packages that were built from source which was added recently. But yeah, I'm a big fan of the idea in general.
|
I don't think so. We do use the linkage information when initially calculating this so I don't think it's ever appropriate to throw away without recalculating based on linkage which is too slow.
Yeh, it is through the
I don't think this is a problem really. I think the inconsistency is the actual/main problem.
Yeh, that seems doable with what I proposed with an extra "ok
Agreed. Not bikeshedding, would love to see this sort of improvement. Just want to be sure that we don't let "perfect be the enemy of good" in trying to get to a slightly better solution to this specific problem first. |
Ideally, I'd like to shoot for correctness but working to make the code consistent in the meantime makes sense especially since this would likely become a performance issue with what I've already proposed. I also have no idea what the scale of this problem is. We have one report of a failed uninstall here and then two cases of
Agreed, I'm fine with any solution that makes these two commands consistent even if
Maybe bikeshedding wasn't the right word there but either way it's obviously outside of the scope of this issue and I wanted to make that clear. IMO that would require a major rethink of the codebase. Should I open another issue to discuss this further? |
I'm still unconvinced the current e.g. tab behaviour is not correct. I'm also dubious that this would be a significant performance issue here without profiling indicating this.
Strongly agree 👍🏻
Probably not 😁. This is the best thing to discuss via e.g. WIP PRs rather than issues, IMO. |
Isn't that what we've been discussing this whole time? I'm very confused. We're all in agreement that the runtime dependencies of a tab can go out-of-date causing discrepancies between In terms of the potential performance issue, I was going on what was said in this thread about how slow the linkage checks are which is mentioned in multiple places. You are right that I haven't actually benchmarked anything. That's not a part of the codebase I'm familiar with so I'd have to go look at it.
Sounds good. 👍 |
Is #14121 related at all to what we've been talking about here? |
No, sorry, but I was 😁
Yeh, I think somewhat although that may fit into the " |
I replaced doing: $ brew upgrade --formula --ignore-pinned by: $ brew update && comm -23 <(brew outdated --formula) <(brew list --formula --pinned) | xargs brew reinstall --formula Would this be the correct "generic" workaround? EDIT: The possible drawback here is that reinstalled formulae with be marked as "installed-on-request" instead of "installed-as-dependency"... |
This is a long-running issue enough I'm not sure leaving it open is terrible actionable. Will review PRs to improve things but given the best part of a year with no movement here: closing it out. |
brew config
outputbrew doctor
outputVerification
brew update
and am still able to reproduce my issue.brew doctor
and that did not fix my problem.What were you trying to do (and why)?
After
brew update && brew upgrade
, I saw that the migration from Python 3.9 to 3.10 seemed completed, and decided to remove the old version.What happened (include all command output)?
What did you expect to happen?
Brew should allow me to remove [email protected]
Step-by-step reproduction instructions (by running
brew
commands)The text was updated successfully, but these errors were encountered: