You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
New Cabal-syntax and an ancient Cabal conflict in a single package (e.g., old hackage-repo-tool on Hackage used both a new Cabal-syntax and ancient Cabal) #8370
See github.com/haskell/hackage-security/runs/7814984300?check_suite_focus=true In hackage-security CI we once hit a bug:
tests/TestSuite/InMemRepo.hs:17:1: error:
Ambiguous module name ‘Distribution.Text’:
it was found in multiple packages:
Cabal-3.6.0.0 Cabal-syntax-3.8.1.0
Edit: this was first spotted in cabal CI originally.
hackage-repo-tool depends on hackage-security, which perhaps is compiled with old Cabal bundled with GHC, but then for some reason (no idea why; perhaps something unrelated fails in the build plan and the solver flips the Cabal-syntax flag and then indeed new Cabal-syntax is mandatory) a new Cabal-syntax is picked and hence the conflict.
changed the title [-]hackage-repo-tool uses both a new Cabal-syntax and and ancient Cabal [/-][+]hackage-repo-tool uses both a new Cabal-syntax and ancient Cabal [/+]on Aug 12, 2022
hackage-repo-tool on Hackage is ancient, but it has reasonable bounds: Cabal (>=1.14 && <1.26 || >=2.0 && <2.6 || >=3.0 && <3.4) and up to date hackage-security bounds. How come this leads to a clash of Cabal-1.24.2.0 and Cabal-syntax-3.8.1.0? I'm worried that user packages may be similarly affected.
I'm changing the topic, because hackage-repo-tool will be updated on Hackage as soon as I get the authorization, but the problem is more general --- our shrewd scheme of bounds on Cabal-syntax, etc., probably doesn't quite work.
changed the title [-]hackage-repo-tool uses both a new Cabal-syntax and ancient Cabal [/-][+]New Cabal-syntax and an ancient Cabal conflict in a single package (e.g., old hackage-repo-tool on Hackage used both a new Cabal-syntax and ancient Cabal)[/+]on Aug 13, 2022
For hackage-repo-tool specifically: somehow, hackage-security-0.6.2.2 gets dependent on Cabal-syntax-3.8.1.0, despite this dependency being hidden behind a flag (cf. cabal-plan tred output below). Curious...
The solver is permitted to flip (some) flags. I'm not an expert on that, though. I think the manual field determines that. If it's not manual, it's solver-amenable. I think in this case it was the intention that solver would flip the flag if newer Cabal can be used. But we haven't imagined a situation like that, where due to other bounds, the solver can't use a new Cabal in some of the deps, while it can in others.
Due to this issue I can't bisect a bug between cabal-install-3.6 and cabal-install-3.8: as noted above, 3.6 fails to build today due to something like:
Expected type: Cabal-syntax-3.10.1.0:Distribution.Types.PackageId.PackageIdentifier
Actual type: PackageId
Any workaround that doesn't require touching checked in files? E.g. can I add a cabal.project.magic that would allow to build cabal-install-3.6 out of a fresh checkout? What would be the minimal such cabal.project.magic? Just pin Hackage index to pre-Cabal-syntax and import cabal.project? Or maybe put some constraint in it (what)?
Update: I got around it and built cabal-install-3.6 by using the following cabal.project.magic
Essentially, yes. Only in my case once the flag is flipped, I see a somewhat different conflict, but the effect is the same, old Cabal conflicting with new Cabal-syntax, which is selected when the flag flips in hackage-security. This stops being a problem with cabal-install 3.8 or later, but I had to build 3.0, 3.2, 3.4 and 3.6 from git repo with manual edits to a cabal.project.freeze file.
The current cabal-syntax flag is too eager too flip to on, even when building old cabal-install that is not compatible with new Cabal-syntax.
Not sure whether it is the same issue but I have recently noticed that hackage-security moved to using Cabal-syntax in a minor version bump, causing some planning issues:
Maybe we should have posted a clarification on the mailing thread for posterity… Unfortunately, no one really knows a good solution it seems. The one I use is to freeze the index to a date in 2022-07.
Activity
Mikolaj commentedon Aug 12, 2022
hackage-repo-tool depends on hackage-security, which perhaps is compiled with old Cabal bundled with GHC, but then for some reason (no idea why; perhaps something unrelated fails in the build plan and the solver flips the Cabal-syntax flag and then indeed new Cabal-syntax is mandatory) a new Cabal-syntax is picked and hence the conflict.
Mikolaj commentedon Aug 12, 2022
Actually, hackage-repo-tool on Hackage is ancient, so this may be why it's broken. Let me update on Hackage.
[-]hackage-repo-tool uses both a new Cabal-syntax and and ancient Cabal [/-][+]hackage-repo-tool uses both a new Cabal-syntax and ancient Cabal [/+]ulysses4ever commentedon Aug 12, 2022
CI link in the OP doesn’t show me anything meaningful (eg no error).
Mikolaj commentedon Aug 12, 2022
The never-ending yellow CI job if full of errors. :)
ulysses4ever commentedon Aug 12, 2022
Oh, right, I see that.
Mikolaj commentedon Aug 13, 2022
hackage-repo-tool on Hackage is ancient, but it has reasonable bounds: Cabal (>=1.14 && <1.26 || >=2.0 && <2.6 || >=3.0 && <3.4) and up to date hackage-security bounds. How come this leads to a clash of Cabal-1.24.2.0 and Cabal-syntax-3.8.1.0? I'm worried that user packages may be similarly affected.
Mikolaj commentedon Aug 13, 2022
I'm changing the topic, because hackage-repo-tool will be updated on Hackage as soon as I get the authorization, but the problem is more general --- our shrewd scheme of bounds on Cabal-syntax, etc., probably doesn't quite work.
[-]hackage-repo-tool uses both a new Cabal-syntax and ancient Cabal [/-][+]New Cabal-syntax and an ancient Cabal conflict in a single package (e.g., old hackage-repo-tool on Hackage used both a new Cabal-syntax and ancient Cabal)[/+]ulysses4ever commentedon Aug 13, 2022
For hackage-repo-tool specifically: somehow, hackage-security-0.6.2.2 gets dependent on Cabal-syntax-3.8.1.0, despite this dependency being hidden behind a flag (cf.

cabal-plan tredoutput below). Curious...Mikolaj commentedon Aug 13, 2022
The solver is permitted to flip (some) flags. I'm not an expert on that, though. I think the
manualfield determines that. If it's not manual, it's solver-amenable. I think in this case it was the intention that solver would flip the flag if newer Cabal can be used. But we haven't imagined a situation like that, where due to other bounds, the solver can't use a new Cabal in some of the deps, while it can in others.Mikolaj commentedon Aug 13, 2022
I think here is the main sketch of the scheme we adopted: haskell/hackage-security#254 (comment)
5 remaining items
andreasabel commentedon Aug 30, 2022
We can add
cabal-install-3.6.2.0to the list of victims of this bug (see #8435 (comment)).Bump cabal
Bump cabal
Bump hackage.nix, haskell.nix, and index-state (#4818)
Use cabal 3.8
Use cabal 3.8 (#1641)
ulysses4ever commentedon Nov 29, 2022
FTR, Stack hit it and worked around by changing the source code to use package imports (which eliminates ambiguity): commercialhaskell/stack#5886
Bump hackage.nix, haskell.nix, and index-state (IntersectMBO#4818)
ulysses4ever commentedon Jun 28, 2023
Due to this issue I can't bisect a bug between
cabal-install-3.6andcabal-install-3.8: as noted above, 3.6 fails to build today due to something like:Any workaround that doesn't require touching checked in files? E.g. can I add a
cabal.project.magicthat would allow to build cabal-install-3.6 out of a fresh checkout? What would be the minimal suchcabal.project.magic? Just pin Hackage index to pre-Cabal-syntax and importcabal.project? Or maybe put some constraint in it (what)?Update: I got around it and built
cabal-install-3.6by using the followingcabal.project.magicThe date is a random point before
Cabal-syntaxwas released on Hackage in August 2022.Bodigrim commentedon Nov 26, 2023
Is it the same issue @vdukhovni hit in https://mail.haskell.org/pipermail/ghc-devs/2023-November/021459.html?
vdukhovni commentedon Nov 26, 2023
Essentially, yes. Only in my case once the flag is flipped, I see a somewhat different conflict, but the effect is the same, old
Cabalconflicting with newCabal-syntax, which is selected when the flag flips inhackage-security. This stops being a problem withcabal-install3.8 or later, but I had to build 3.0, 3.2, 3.4 and 3.6 from git repo with manual edits to acabal.project.freezefile.The current
cabal-syntaxflag is too eager too flip to on, even when building oldcabal-installthat is not compatible with newCabal-syntax.andreabedini commentedon Nov 26, 2023
Not sure whether it is the same issue but I have recently noticed that hackage-security moved to using Cabal-syntax in a minor version bump, causing some planning issues:
#9457 (comment)
PS: I checked the email thread, yes, it is the same issue.
ulysses4ever commentedon Nov 28, 2023
Maybe we should have posted a clarification on the mailing thread for posterity… Unfortunately, no one really knows a good solution it seems. The one I use is to freeze the index to a date in 2022-07.