-
Notifications
You must be signed in to change notification settings - Fork 372
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
Transitive post dependencies can be unreliable #5010
Comments
Possible options discussed:
|
Currently, B having "A {post}" means "A can be installed at any point (before or) after B". In particular, other packages depending on B may be installed after B may before A, or concurrently with A. If they need A to be installed before, they should explicitly mark A as a dependency. The problem that you report is that this UI is prone to misinterpretation. Users interpret "A {post}" as "A will be installed right after this package", because this is what they observe by running individual "opam install" commands. So they think their package only only needs to depends on B, even when they in fact depend on A. If you decide to automatically make A a normal dependency of any C depending on B, this is the behavior you are enforcing: from the point of view of packages depending on B, A gets installed "right after B". But then @dra27 remarks that this can introduce cycles. If A decides to depend on another package D that itself depends on B, then we need to install (B; D; A), and not install A "right after B". The following interpretation could solve this problem:
Both interpretations (the current one and the proposed one) make sense / are consistent, the question is which one will make repository maintenance easier. I tend to think that my proposal is better than the current behavior:
The proposal does have one bad property, which is that it breaks the usual interpretation that adding dependencies only adds more constraints. Here adding a dependency can relax an existing inferred constraint. This is odd and possibly a reason to reject it. |
Another problem with my proposal: in the situation where B post-depends on A, and we add a dependency D on A that depends on B (so we want the outcome (B; D; A)), things break with my proposal and they are fixed by changing the metadata of D, not A. We edit D to clarify that the dependency (which was assumed to be normal-depend) can in fact be relaxed. It is bad that a change in A's metadata requires a change in D. The justification is that if D depends on B and can have A as a post-dependency and didn't say so explicitly, then (under the proposed bhavior) its packaging information is "too strict" and needs to be fixed to be made more accurate. In a sense we are deciding who should be extra careful when they depend on B who post-depends on A:
|
Note: in the case of
Then we get the expected behavior by default, without having to change OPAM's behavior in subtle way. (Or: Maybe the simplest solution is just to discourage the use of |
Let’s define
A
with:depopt: ["B"]
B
with:depends: ["A" {post}]
C
with:depends: ["B"]
e.g.
A
isctypes
,B
isctypes-foreign
andC
is a user ofctypes
Depending on how
C
is installed, a race condition can occure ifC
usesA
under the hood.A
can either be installed before (will succeed) or after (will fail)C
or even cause race-condition whereA
is in a half-installed state.The issue is that it is not obvious to the user and very tricky to debug for repository maintainers.
Example of such issue: ocaml/opam-repository@4960621
The text was updated successfully, but these errors were encountered: