Giter Club home page Giter Club logo

Comments (35)

andreasabel avatar andreasabel commented on June 16, 2024 3

Cabal developer meeting 2024-05-23 gave no objections against removing the constraint and instead throw a warning, preferably in cabal build (rather than in cabal check).
Removing the constraint can be done here:

. addSetupCabalMaxVersionConstraint setupMaxCabalVersionConstraint

If anyone has a pointer where to throw warnings in preparations of cabal build (like when we start the constraint solver), I would be grateful!

Would this proposal (replace by warning) find a general consensus?
(Pinging @Bodigrim @mpickering.)
Would be good to resolve this issue soon...

from cabal.

andreasabel avatar andreasabel commented on June 16, 2024 2

Thanks for digging this out @Bodigrim!

Maybe one should not have search through the source code of cabal to get this information.

  1. The docs (see OP) need to mention this.

  2. The reason for the constraint should be clearer. Currently it says:

    (constraint from maximum version of Cabal used by Setup.hs requires <3.12)

    Better formulation:

    (the use of cabal 3.10.* limits the maximum version of Cabal used by Setup.hs to <3.12)

I am also a bit skeptical about placing this limit in the first place.

As we can't predict the future, we also place a global upper bound on the lib:Cabal version we know how to interact with

This sound to me like:

As I cannot predict whether my house will stand for 50 years, I will tear it down after 20 years.

I do not see the point of forcing pessimism into the constraint solving here.
Should things actually break with a too new Cabal, then I can always place a suitable upper bound with -c setup.Cabal < VERSION, or can't I?

from cabal.

mpickering avatar mpickering commented on June 16, 2024 2

I think it makes sense to have some kind of support window like this for older versions of cabal-install because there's no guarantee an old version of cabal-install will know how to interact with a ./Setup built with a new version of Cabal.

By similar reasoning, if you want to build packages which use a new version of Cabal library then you need to use a tool which knows how to communicate with that (and there's no guarantee that the interface will happen to be the same as before).

  • Older versions might not pass a specific flag which is now needed for the build to work
  • Older versions might pass a flag which doesn't exist anymore

Possible failures include:

  • Loud confusing failures about passing unknown arguments to newer Cabal library versions.
  • Silent failures, where not everything you expect to be built is built or things are built incorrectly.

Perhaps the right solution is a flag to allow power users to opt out of this constraint and venture into any unknown territory if they desire but I thin forcing general users to upgrade to something which works is a better overall experience.

from cabal.

andreasabel avatar andreasabel commented on June 16, 2024 2

@mpickering wrote:

Perhaps the right solution is a flag to allow power users to opt out of this constraint and venture into any unknown territory

Why yet another flag? cabal is already giving a loud warning whenever it is used with a new version of GHC it as not been certified for. Wouldn't the same suffice for a newer version of Cabal?

from cabal.

michaelpj avatar michaelpj commented on June 16, 2024 2

+1 for a warning. If the user hasn't set an upper bound then they're asking to use whatever new version of Cabal comes along. That may not be a good idea, but it's what they asked for! By all means warn if it's worrying, but it's quite annoying to not follow what the user stated.

from cabal.

andreasabel avatar andreasabel commented on June 16, 2024 2

I'd use cabal-install preleases if they were in ghcup prerelease channel

I see this in ghcup list:

✔✔ cabal 3.10.3.0           latest,recommended                                    
✗  cabal 3.11.0.0.2024.4.19 latest-prerelease      

ghcup config:

...
url-source:
- GHCupURL
- https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml
- https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml
- https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml

from cabal.

Bodigrim avatar Bodigrim commented on June 16, 2024 1

This is expected behavior:

-- As we can't predict the future, we also place a global upper
-- bound on the lib:Cabal version we know how to interact with:
--
-- The upper bound is computed by incrementing the current major
-- version twice in order to allow for the current version, as
-- well as the next adjacent major version (one of which will not
-- be released, as only "even major" versions of Cabal are
-- released to Hackage or bundled with proper GHC releases).
--
-- For instance, if the current version of cabal-install is an odd
-- development version, e.g. Cabal-2.1.0.0, then we impose an
-- upper bound `setup.Cabal < 2.3`; if `cabal-install` is on a
-- stable/release even version, e.g. Cabal-2.2.1.0, the upper
-- bound is `setup.Cabal < 2.4`. This gives us enough flexibility
-- when dealing with development snapshots of Cabal and cabal-install.
--
setupMaxCabalVersionConstraint =
alterVersion (take 2) $ incVersion 1 $ incVersion 1 cabalVersion

from cabal.

Bodigrim avatar Bodigrim commented on June 16, 2024 1

I am also a bit skeptical about placing this limit in the first place.

Given that Cabal-X is usually released a few weeks earlier than cabal-install-X, the limitation is quite annoying.

Could it be "current version + 4"? So that cabal-install-3.10 could be used to test Cabal-3.12, hoping that cabal-install-3.12 will be available in time for Cabal-3.14.

from cabal.

RyanGlScott avatar RyanGlScott commented on June 16, 2024 1

I have encountered the same issue in the context of any constraints. For instance, if you attempt to compile a project with:

  1. A custom Setup.hs script

  2. cabal-install-3.10.* + ghc-9.10.*

  3. The following cabal.project.local file:

    constraints: any.Cabal installed
    

Then cabal will reject the build plan with a similar error, even though I have not placed an upper bound on Cabal in the .cabal file:

$ cabal build -w ghc-9.10
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] trying: cabal-sandbox-0.1 (user goal)
[__1] next goal: cabal-sandbox:setup.Cabal (dependency of cabal-sandbox)
[__1] rejecting: cabal-sandbox:setup.Cabal-3.12.0.0/installed-be90 (constraint
from maximum version of Cabal used by Setup.hs requires <3.12)

This is especially annoying now that haskell-ci generates installed constraints that use any, so I can't use haskell-ci in my project with a custom Setup.hs script anymore.

from cabal.

andreasabel avatar andreasabel commented on June 16, 2024 1

I am also a bit skeptical about placing this limit in the first place.

It's like having base <5. Just remove all the upper bounds everywhere!

cabal-install-3.10 does not force base < 4.20 and shouldn't force Cabal < 3.12 either. Let the developer decide whether to take a optimistic or pessimistic approach to the possibility of breakage by future changes.

Upper bounds are needed to prevent build failures. So one can remove upper bounds for which no build failures are known. Preferably one will respond quickly to build failures by adding upper bounds through hackage revisions.

in the possible future case that cabal-install-x.y.z.w won't work with Cabal-x.y+2, the proper bug fix

The proper fix is then to add a Cabal < 3.13 bound to your setup-depends. No action needed from the maintainers of Cabal. Why should this be so different from other upper bounds? The caution will have Cabal < 3.13 anyways, the gamblers might not have it, but let them gamble!

from cabal.

andreasabel avatar andreasabel commented on June 16, 2024

Ruining my CIs...: https://github.com/BNFC/bnfc/actions/runs/8800309303/job/24151220023#step:15:28

from cabal.

andreasabel avatar andreasabel commented on June 16, 2024

@ffaf1: This issue prevents me from evaluating Cabal-3.12 with a released cabal-install, and the following one with master:

Not sure how I should verify relaxations to Cabal < 3.13 in my projects now...

from cabal.

andreasabel avatar andreasabel commented on June 16, 2024

The original issue seems to be:

However this issue only speaks about warnings which I find totally appropriate.
So we would want a warning if cabal-x builds Setup.hs with Cabal-y where y is a release version bigger than x rather than a hard constraint one cannot overwrite.

The commit that introduced the OP is c92b715. It has no tests and no doc changes may thus be simply revertible.

from cabal.

Mikolaj avatar Mikolaj commented on June 16, 2024

Thank you for the report. I think you are right the documentation is outdated and too flimsy here. Let's discuss the proposal to revert c92b715. If agreed upon, that would go into cabal 3.14, I imagine. A PR with the revert would be useful (once our CI gets fixed).

Beyond the documentation and the proposal, is there anything else in this ticket? Any bug in cabal 3.12 or 3.10, for example?

from cabal.

andreasabel avatar andreasabel commented on June 16, 2024

Any bug in cabal 3.12 or 3.10, for example?

Well, I'd say the behavior I report here is a bug, others might disagree, e.g. @hvr who authored said commit.
It is certainly limiting cabal-install without known workaround.

from cabal.

Mikolaj avatar Mikolaj commented on June 16, 2024

I should have been more precise: any bug introduced in cabal 3.10 or 3.12?

from cabal.

ffaf1 avatar ffaf1 commented on June 16, 2024

Perhaps the right solution is a flag to allow power users to opt out of this constraint and venture into any unknown territory if they desire.

I think this is a very good way forward.

w/r/t broken CIs, can this be worked around. Can cabal make something immediate that eases the pain on users?

from cabal.

Mikolaj avatar Mikolaj commented on June 16, 2024

Let me repeat the question: could we change something small in cabal 3.12 that would help in some of the cases? Or in cabal 3.14 if there's a risk that'd break things?

from cabal.

Mikolaj avatar Mikolaj commented on June 16, 2024

See also haskell/haskell-language-server#4196 and #9632 it links to (please tell me if these are unrelated to the current issue).

from cabal.

andreasabel avatar andreasabel commented on June 16, 2024

Pointers towards implementing a warning:

from cabal.

Bodigrim avatar Bodigrim commented on June 16, 2024

Would this proposal (replace by warning) find a general consensus?

I'm in favor.

from cabal.

Mikolaj avatar Mikolaj commented on June 16, 2024

@mpickering: you had concerns and you favoured a poweruser flag. Would a warning make sense to you, too? How specific the warning would need to be? Would a cheap warning whenever that the user hasn't set an upper bound (regardless of whether this affected the build plan) be good enough?

from cabal.

ffaf1 avatar ffaf1 commented on June 16, 2024

We don't shaft users, this has to make next cabal-install release.

from cabal.

mpickering avatar mpickering commented on June 16, 2024

@Mikolaj I don't have any particular more comments to what I already made (there is no a priori reason that using a new Cabal library version will continue to work with an old cabal-install release).

@RyanGlScott It seems like a bug in haskell-ci to force you to used the installed Cabal library version?

from cabal.

RyanGlScott avatar RyanGlScott commented on June 16, 2024

It seems like a bug in haskell-ci to force you to used the installed Cabal library version?

I don't think I know enough about haskell-ci's design considerations to say for sure. That being said, given that there is (seemingly) no workaround for this bug other than to remove the use of any, I've requested that haskell-ci allow toggling the use of any in haskell-CI/haskell-ci#728.

from cabal.

phadej avatar phadej commented on June 16, 2024

Could it be "current version + 4"?

That would require to be more careful about backward compatibility of ./Setup interface.

I'd say that promptly managing the cabal-install releases should be easier.

from cabal.

phadej avatar phadej commented on June 16, 2024

I am also a bit skeptical about placing this limit in the first place.

It's like having base <5. Just remove all the upper bounds everywhere!

I don't trust that in the possible future case that cabal-install-x.y.z.w won't work with Cabal-x.y+2, the proper bug fix will be promptly released. Nor there are possibility to make a "revision" do disallow that combination, the broken cabal-install-x.y.z.w will be there, and people would need find out they need to upgrade.

from cabal.

phadej avatar phadej commented on June 16, 2024

Let the developer decide whether to take a optimistic or pessimistic approach to the possibility of breakage by future changes.

The cabal-install is "the developer" there. It calls ./Setup interface. If Cabal-x.y+2 changes something, cabal-install-x.y cannot know. This "internal" dependency of cabal-install on Cabal (in case of custom-setup packages) is not editable by hackage revisions.

The proper fix is then to add a Cabal < 3.13 bound to your setup-depends.

It's not as I try to explain. The cabal-install-3.14 would work without the constraint, cabal-install-3.12 won't.

from cabal.

phadej avatar phadej commented on June 16, 2024

Re haskell-ci issue. In the future, once we test GHC release alphas and candidates, it would be great if there were corresponding cabal-install release candidates so we can test that bundled ./Cabal version etc. works with build-type: Custom packages.

Ltely GHC release management has been improved, the GHC-9.10.1 was released on the date advertised few months in advance, so it should be possible to get cabal-install released close to GHC releases in the future.

from cabal.

ulysses4ever avatar ulysses4ever commented on June 16, 2024

@RyanGlScott have you considered using the prerelease advertized in the Cabal-3.12 announcement? It should work for custom setups. https://discourse.haskell.org/t/ann-cabal-3-12-0-0-released/9504#how-to-get-the-cabal-install-pre-release-3

from cabal.

RyanGlScott avatar RyanGlScott commented on June 16, 2024

I will happily use cabal-install-3.12.0.0 once it is fully supported by ghcup and haskell-ci.

from cabal.

phadej avatar phadej commented on June 16, 2024

I'd use cabal-install preleases if they were in ghcup prerelease channel

I was unaware there are cabal-install prerelease, as it didn't show up in ghcup list. I don't read discourse.

from cabal.

Bodigrim avatar Bodigrim commented on June 16, 2024

Could it be "current version + 4"?

That would require to be more careful about backward compatibility of ./Setup interface.

...which is worth doing anyway.

I'd say that promptly managing the cabal-install releases should be easier.

One would hope so, but apparently it's not.

from cabal.

andreasabel avatar andreasabel commented on June 16, 2024

@phadej

It's not as I try to explain. The cabal-install-3.14 would work without the constraint, cabal-install-3.12 won't.

Ok, my model seems to be naive. I thought that it is only Setup.hs that needs the right Cabal version to build and function, but it the same library Cabal that dictates how cabal-install invokes Setup, and yes, then there is possibility of incongruence which isn't fixable either.

Still, replacing the hardwired Cabal <... constraint by a stern warning seems a possibility.

from cabal.

phadej avatar phadej commented on June 16, 2024

I tested with cabal 3.11.0.0.2024.4.19 and the Cabal-3.12.0.0 is picked up for setup-depends.

So the only "issue" I see here, is that cabal-install-3.12.0.0 is not released.

from cabal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.