haskell / haskell/cabal

cabal doesn't reconfigure ghc-pkg when binary on PATH changes

Open
#11,417 6 comments 0 reactions 0 assignees View on GitHub
can-workaround recompilation type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**

Perhaps related to #11373

`cabal-3.16.1.0` doesn't reconfigure `ghc-pkg` when I switch the `ghc` version on PATH.

**To Reproduce**
Steps to reproduce the behaviour:

```sh
> cabal-3.16.1.0 get text-2.1.3
> cd text-2.1.3
> ghcup install ghc --set 9.10.3
> cabal-3.16.1.0 path
> ghcup install ghc --set 9.12.2
> cabal-3.16.1.0 path
Error: [Cabal-4000]
Version mismatch between ghc and ghc-pkg: C:\ghcup\bin\ghc.exe is version 9.10.3 C:\ghcup\bin\ghc-pkg.exe is version 9.12.2
```

**Expected behavior**

Should correctly reconfigure and show the output of `cabal path` regardless. Works fine on `cabal-3.14.2.0` on windows.

**System information**
- Windows (uncovered by HLS CI)
- I would guess this is reproducible on linux as well
- `cabal-3.16.1.0`
- `ghc` versions 9.12.2 and 9.10.3 but probably irrelevant

**Workaround**

Remove `dist-newstyle` directory.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.