Repository navigation
Conversation
Since 3.18, cabal-install ran the ghc-pkg that it found next to ghc, not the one that the user gave with --with-ghc-pkg or with ghc-pkg-location in the project file. configureCompiler drops the unconfigured programs of the cached ProgramDb before configCompilerProgDb configures ghc-pkg, and the user's location for a program is kept on its unconfigured entry. The user's locations are applied again afterwards, but that has no effect on a program that is already configured. So the user's ghc-pkg location is now passed to configCompilerProgDb, as --with-hc-pkg is. --with-hc-pkg still takes precedence over it. The WithGhcPkg test now checks --with-ghc-pkg and ghc-pkg-location as well as --with-hc-pkg. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2907313 to
6e6e1fc
Compare
This PR definitely modifies behaviour. |
Well, it's fixing a regression, I don't know whether that should be considered a behaviour change but there's a changelog entry anyway. |
| hc | ||
| (clearUnconfiguredPrograms hcProgDb) | ||
| hcPkg | ||
| (hcPkg <|> lookup "ghc-pkg" userProgramPaths) |
There was a problem hiding this comment.
I'm sorry, but I really don't like these band-aid fixes that tack on ad-hoc logic. I'm already finding it very hard to bring some sense to the Cabal codebase; I don't want a proliferation of LLM-assisted PRs entangling the logic further.
As written, this change means that the rule "--with-hc-pkg overrides the ghc-pkg location" lives in two places: in cabal-install (here) and in Cabal's configureCompilerPrograms. The fix should be to change configCompilerProgDb to avoid losing the user-specified path of ghc-pkg, not paper over it after the fact.
|
If you can wait a bit, I'm working on approach that will fix this in #12556. I haven't pushed yet, as the further I dig the more issues I find need to be resolved for a coherent solution. |
|
Cool, I'll close this one then. |
Since 3.18, cabal-install ran the ghc-pkg that it found next to ghc, not the one that the user gave with --with-ghc-pkg or with ghc-pkg-location in the project file.
configureCompiler drops the unconfigured programs of the cached ProgramDb before configCompilerProgDb configures ghc-pkg, and the user's location for a program is kept on its unconfigured entry. The user's locations are applied again afterwards, but that has no effect on a program that is already configured. So the user's ghc-pkg location is now passed to configCompilerProgDb, as --with-hc-pkg is. --with-hc-pkg still takes precedence over it.
Template B: This PR does not modify behaviour or interface
E.g. the PR only touches documentation or tests, does refactorings, etc.
Include the following checklist in your PR: