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

Incorrect upper bounds generated #6

Open
brprice opened this issue Sep 22, 2022 · 0 comments
Open

Incorrect upper bounds generated #6

brprice opened this issue Sep 22, 2022 · 0 comments

Comments

@brprice
Copy link

brprice commented Sep 22, 2022

Consider the following sequence of commands

  • cabal-edit latest optics: says the latest is optics ^>= 0.4
  • cabal-edit add optics: adds the dependency optics ^>= 0.4
  • cabal-edit update optics: changes the dependency to optics >=0.4 && <=0.5 (Note the use of <= here)

There two things to note here. A minor distraction is that upgrading an up-to-date package changed the cabal file. The much more important thing is that this upper bound is incorrect!

This claims we will be compatible with an as-yet-unreleased new major version of optics. I don't think that this is what the version bound should be. I expect I should have either of

  • optics >=0.4 && <0.5, (which is equivalent to the original bound). This says "compatible until the next major version bump".
  • optics >=0.4 && <=0.4 (I chose a bad example here, for a current dependency of dep ^>= 1.2.3.4 and a newer version of 1.7.8.9 we would get dep >=1.2.3.4 && <= 1.7.8.9). This says "compatible with the currently-released version, but maybe not anything later, even minor/patch releases".

I think the confusion in the code is between

let ver' = majorUpperBound latestVer
(computing the new version to pass to upgrade - note that majorUpperBound computes the next-greater major version - and
upgrade pk latest (_, cabalFile) =
&
let ver' = intersectVersionRanges (orLaterVersion prev) (orEarlierVersion latest)
where the upgrade function seems to use it as the latest version (thus putting a <= bound).

I think the fix should be straightforward and am willing to send a PR once it is clear which of the two options would be preferable. (Note to self: potentially is worth adding a lint pass to detect a <= bound on a non-existing version number?)

dhess added a commit to hackworthltd/primer that referenced this issue Oct 15, 2022
Also, we make the following changes:

* Switch back to the haskell.nix-provided HLS.

* Undo the workarounds needed for
input-output-hk/haskell.nix#1177 as that
issue has now been fixed upstream.

* disable the NixOS test framework for the time being until I can port
it to the next NixOS test system.

* Switch to fourmolu 0.8.2 as building 0.7 causes a segfault on
`aarch64-darwin`, all of a sudden.

* Reformat our Cabal files using the latest `cabal-fmt`.

* Drop the GHC 8.10.7 workaround for `cabal-fmt`.

* Drop `cabal-edit` from our toolset, as it produces bad PVP bounds,
and has apparently been abandoned upstream. See
sdiehl/cabal-edit#6
dhess added a commit to hackworthltd/primer that referenced this issue Oct 15, 2022
Also, we make the following changes:

* Switch back to the haskell.nix-provided HLS.

* Undo the workarounds needed for
input-output-hk/haskell.nix#1177 as that
issue has now been fixed upstream.

* disable the NixOS test framework for the time being until I can port
it to the next NixOS test system.

* Switch to fourmolu 0.8.2 as building 0.7 causes a segfault on
`aarch64-darwin`, all of a sudden.

* Reformat our Cabal files using the latest `cabal-fmt`.

* Drop the GHC 8.10.7 workaround for `cabal-fmt`.

* Drop `cabal-edit` from our toolset, as it produces bad PVP bounds,
and has apparently been abandoned upstream. See
sdiehl/cabal-edit#6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant