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

Cabal-3.8.1.0 depends on too recent process-1.6.14, rendering it unusable with package ghc-9.2.4 and older #8554

Closed
Tracked by #1141
andreasabel opened this issue Oct 26, 2022 · 27 comments
Assignees
Labels
re: dependencies Concerning Cabal's dependencies regression in 3.8

Comments

@andreasabel
Copy link
Member

Lifted from #8489 (comment):

Cabal-3.8.1.0 comes with a constraint process >= 1.6.14 (released 2022) for ghc >= 8.2 (released 2017!). This looks non-sensical to me. It makes cabal trying to reinstall the ghc package, which is bound to fail. In the wild:

cabal-3.6.2.0: Could not resolve dependencies:
[__0] trying: hackage-server-0.5.1 (user goal)
[__1] rejecting: hackage-server:!test (constraint from config file, command line flag, or user target requires opposite flag selection)
[__1] trying: hackage-server:*test
[__2] trying: doctest-parallel-0.2.5 (dependency of hackage-server *test)
[__3] trying: ghc-9.2.4/installed-9.2.4 (dependency of doctest-parallel)
[__4] next goal: Cabal (dependency of hackage-server)
[__4] rejecting: Cabal-3.6.3.0/installed-3.6.3.0 (conflict: hackage-server => Cabal^>=3.8.1.0)
[__4] rejecting: Cabal-3.8.1.0 (conflict: ghc => process==1.6.13.2/installed-1.6.13.2, Cabal => process>=1.6.14.0 && <1.7)

Blame for the process >= 1.6.14 constraint goes to 95cf762. (Ping @robx.)

Sat Jul 9 14:48:25 2022 +0200
Cabal: depend on process-1.6.14.0 to fix waitForProcess error message

This is guarded to be for GHC from 8.2 only, since the process release depends on base-4.10.

This extra constraint seems to have been removed from master in the meantime.

However, it seems like a release of Cabal-3.8 is warranted to render Cabal-3.8 usable with the preinstalled ghc package below 9.4.

@andreasabel andreasabel added re: dependencies Concerning Cabal's dependencies regression in 3.8 labels Oct 26, 2022
@andreasabel andreasabel changed the title Cabal-3.8.1.0 depends on the way to new process-1.6.14, rendering it unusable with package ghc-9.2.4 and older Cabal-3.8.1.0 depends on too recent process-1.6.14, rendering it unusable with package ghc-9.2.4 and older Oct 26, 2022
@andreasabel
Copy link
Member Author

Reproducer: cabal build -w 9.2.4 on a .cabal with these dependencies:

    build-depends:
        base
      , Cabal == 3.8.1.0
      , ghc

This gives:

Build profile: -w ghc-9.2.4 -O1
In order, the following will be built (use -v for more details):
 - process-1.6.16.0 (lib:process) (requires download & build)
 - ghc-9.2.4 (lib) (requires build)
 - Cabal-3.8.1.0 (lib) (requires build)
...

I attach the toy project as zip file.
issue-8554.zip

andreasabel added a commit to haskell/hackage-server that referenced this issue Oct 26, 2022
Reason: haskell/cabal#8554
Cabal-3.8.1.0 does not work with ghc < 9.4 needed by doctest-parallel
@Mikolaj
Copy link
Member

Mikolaj commented Oct 26, 2022

@andreasabel: I can't see this bound on https://hackage.haskell.org/package/Cabal nor on master nor 3.8 branch in the repo.

And your log says "cabal-3.6.2.0: Could not resolve dependencies".

Could you investigate some more?

@ulysses4ever
Copy link
Collaborator

ulysses4ever commented Oct 26, 2022

Cabal has backwards compatibility obligation w.r.t. GHC the program, which it adheres.I don't know of any promises w.r.t. ghc the package.

@ulysses4ever
Copy link
Collaborator

Sorry, wrong button and premature send.

So, as it stands, a dependency (if it exists) or constraint that rules out older ghcs doesn't violate anything per se. Maybe we should consider introducing a back-compat promise for ghc (the package)? It may sound reasonable but is it worth it? Beneficiaries of this would be those who depend on both Cabal and ghc. Not a big market, I'd guess. Of course, if there are critical infrastructure packages among those, it may be justified.

@Mikolaj
Copy link
Member

Mikolaj commented Oct 26, 2022

Actually, I can see the bound for process on Hackage when I look inside the .cabal file --- Hackage doesn't display the bound on the main page, because of the condition. I'm still puzzled where this bound has been removed on 3.8 branch. Blame shows nothing.

@Mikolaj
Copy link
Member

Mikolaj commented Oct 26, 2022

OK, I've found it: #8342

So, it seems this is fixed already, just not released. Apologies for any inconvenience.

@Mikolaj
Copy link
Member

Mikolaj commented Oct 26, 2022

Apparently, git blame does not show deletions?

@andreasabel
Copy link
Member Author

@ulysses4ever wrote:

Beneficiaries of this would be those who depend on both Cabal and ghc. Not a big market, I'd guess. Of course, if there are critical infrastructure packages among those, it may be justified.

Does hackage-server qualify here? ;-) There are also doctest and friends that might be affected.

@Mikolaj wrote:

@andreasabel: I can't see this bound on https://hackage.haskell.org/package/Cabal nor on master nor 3.8 branch in the repo.

I also stumbled over this; blame goes to how hackage-server displays conditional dependencies, simply taking the union. The union is bogus, of course, as would be the intersection, the only correct display would be it is complicated.

Apparently, git blame does not show deletions?

Regrettably, yes. It only shows you how each line that survived evolution came to be... The links that died out are missing.

@andreasabel
Copy link
Member Author

Would a release of the following PR, say as Cabal-3.8.1.1, fix the situation?

@Mikolaj
Copy link
Member

Mikolaj commented Oct 27, 2022

Alternatively, I could try removing the bound via a revision on Hackage, but the bound was there for a reason (and it got bumped even higher before it got moved to cabal-install). So I'd need to also add it to cabal-install instead. That's a quick and dirty solution.

@gbaz
Copy link
Collaborator

gbaz commented Oct 27, 2022

@andreasabel for just making things work for hackage server, we can toss allow-older into the cabal.project file :-)

@andreasabel
Copy link
Member Author

Alternatively, I could try removing the bound via a revision on Hackage, but the bound was there for a reason (and it got bumped even higher before it got moved to cabal-install). So I'd need to also add it to cabal-install instead. That's a quick and dirty solution.

Revisions are subject to some limits, e.g. one cannot add or remove conditionals. Of course, changing the conditional dependency to process -any is as good as removing it.

@andreasabel
Copy link
Member Author

@gbaz wrote:

@andreasabel for just making things work for hackage server, we can toss allow-older into the cabal.project file :-)

Thanks for the hint, this workaround works in any case locally. Not sure if such settings are taken into account by haskell-ci, but I'll try. In any case, such workarounds do not exist for packages pushed to hackage.

@andreasabel
Copy link
Member Author

Not sure if such settings are taken into account by haskell-ci, but I'll try.

The answer to this is negative, unfortunately, allow-newer/older settings (as all settings in the cabal.project file) are ignored (i.e. overwritten) by haskell-ci.

@Mikolaj
Copy link
Member

Mikolaj commented Oct 27, 2022

The answer to this is negative, unfortunately, allow-newer/older settings (as all settings in the cabal.project file) are ignored (i.e. overwritten) by haskell-ci.

Yes, I remember having to edit haskell-ci yaml by hand when adding GHC HEAD to some package's CI.

andreasabel added a commit to haskell/hackage-server that referenced this issue Oct 28, 2022
@jneira
Copy link
Member

jneira commented Oct 28, 2022

hmm maybe haskell-ci should be improved to allow custom cabal.project config?
btw I think hls is another example of a package depending on both cabal and ghc, so another central piece of Haskell ecosystem could be affected

@ulysses4ever
Copy link
Collaborator

haskell-ci doesn't depend on ghc. And the decision to not take into account project files was deliberate afaiu (e.g. it's supposed to test the workflow where you download the package from Hackage).

andreasabel added a commit to haskell/hackage-server that referenced this issue Oct 29, 2022
This commit makes `hackage-server` compile with Cabal-3.8, but does not add any Cabal-3.8 specific features.

Adds `allow-older: Cabal:process` to solve a conflict arising from these two dependency chains:
- Cabal-3.8.1.0 -> process >= 1.6.14
- Cabal-3.8.1.0 -> doctest-parallel -> ghc -> process

For `ghc < 9.4`, this means `process < 1.6.14`, and the `ghc` package is not upgradeable, so the only solution is to override `Cabal-3.8.1.0`s request for this very recent version of `process`.
The conflict is discussed in haskell/cabal#8554.

Likely, the next release of `Cabal-3.8` will drop the request for a specific `process` library and we can drop the `allow-older` workaround, and also reenable the tests on Haskell-CI for GHC < 9.4  (see `cabal.haskell-ci`).
@jneira
Copy link
Member

jneira commented Oct 29, 2022

yeah and maybe it is a good default but it makes haskell-ci not usable in projects like cabal or hls
but it should belong to haskell-ci issue tracker, of course

@andreasabel
Copy link
Member Author

haskell-ci ... the decision to not take into account project files was deliberate afaiu (e.g. it's supposed to test the workflow where you download the package from Hackage).

Yes, this is a stricter CI scenario than building from the repo. I come to appreciate it. It also prevent situations where a maintainer may think that adding dependency relaxations to cabal.project is sufficient---when they actually do not propagate to the Hackage release (cf. coot/ghc-tags-plugin#50 (comment)).

@andreasabel
Copy link
Member Author

Suggested course of action (#8342 (comment)):

  • revise the said conditional constraint in Cabal-3.8.1.0 to process -any
  • release a cabal-install-3.8.1.1 with just this conditional constraint added over 3.8.1.0

@andreasabel
Copy link
Member Author

@gbaz
Copy link
Collaborator

gbaz commented Feb 23, 2023

Just to note that today's discussion suggests "relax the constraint in Cabal, tighten the constraint in cabal-install, just revisions, no releases necessary"

@andreasabel
Copy link
Member Author

Indeed, see my summary at #8653 (comment).

@andreasabel
Copy link
Member Author

andreasabel commented Feb 26, 2023

This is now fixed (hopefully). I made the respective Hackage revisions, further info at:

@Mikolaj
Copy link
Member

Mikolaj commented Feb 27, 2023

Wow, so it was possible after all? Is it confirmed in the field by now? E.g., do the compilations that failed previously in the wild succeed now in the wild?

@andreasabel
Copy link
Member Author

andreasabel commented Feb 27, 2023

Well, at least for my use case I was successful: hackage-server can now use doctest-parallel testing even at GHC 9.2 and below.

Originally, I didn't think one could revise if impl(ghc >= 8.2) build-depends: process >= 0.16.4. But this was my mental limitation: I didn't consider that one can leave the if in place but make its content trivial, like process >= 0.

@Mikolaj
Copy link
Member

Mikolaj commented Feb 27, 2023

Splendid! The dev chats turn out useful in many way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
re: dependencies Concerning Cabal's dependencies regression in 3.8
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants