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

[Windows] GHCup points to wrong store directory when removing GHC #1089

Closed
jasagredo opened this issue Jun 26, 2024 · 4 comments
Closed

[Windows] GHCup points to wrong store directory when removing GHC #1089

jasagredo opened this issue Jun 26, 2024 · 4 comments

Comments

@jasagredo
Copy link

Removing a GHC shows the following message:

[ Info  ] Removing ghc-x.y.z symlinks
[ Info  ] Removing/rewiring ghc-x.y symlinks
[ Info  ] Removing files safely from: C:\ghcup\ghc\9.4.8
[ Info  ] After removing GHC you might also want to clean up your cabal store at: C:\Users\Javier\AppData\Roaming\cabal\store\ghc-9.4.8
Success
Press enter to continue

However that directory is wrong. It should point to C:\Users\Javier\AppData\Local\cabal\store\ghc-9.4.8.

This seems to be caused by readConfig from cabal-install-parsers, which does:

resolveConfig :: Config Maybe -> IO (Config Identity)
resolveConfig cfg = do
    c <- findCabalDir
    return cfg
        { ...
        , cfgStoreDir        = Identity $ fromMaybe (c </> "store")    (cfgStoreDir cfg)
        }

Which is wrong for the default directories on Windows. For the record, this is what the directories look like:

➜ ls ~/AppData/{Local/cabal,Roaming/cabal}
/c/Users/Javier/AppData/Local/cabal:
logs  script-builds  store

/c/Users/Javier/AppData/Roaming/cabal:
bin  config  logs  packages

And this is my cabal config file, only the fields that are not commented:

repository hackage.haskell.org
  url: http://hackage.haskell.org/
remote-repo-cache: C:\Users\Javier\AppData\Roaming\cabal\packages
extra-include-dirs: C:\msys64\clang64\include
extra-lib-dirs: C:\msys64\clang64\lib
extra-prog-path: C:\ghcup\bin,
                 C:\Users\Javier\AppData\Roaming\cabal\bin,
                 C:\msys64\clang64\bin,
                 C:\msys64\usr\bin
build-summary: C:\Users\Javier\AppData\Roaming\cabal\logs\build.log
remote-build-reporting: none
jobs: $ncpus
installdir: C:\Users\Javier\AppData\Roaming\cabal\bin
haddock
init
install-dirs user
install-dirs global
program-locations
program-default-options
  ghc-options: -optc-Wno-pragma-pack -optc-Wno-macro-redefined -optc-Wno-missing-declarations
@hasufell
Copy link
Member

So it's a bug in cabal-install-parsers then?

@jasagredo
Copy link
Author

It seems like that, yeah. GHCup could do some workaround over it or shall I upstream the issue?

@hasufell
Copy link
Member

Best we fix it upstream.

@jasagredo
Copy link
Author

Ah I think this issue summarizes the situation upstream. haskell-CI/haskell-ci#655. What remains then for GHCup is whether to use something different of live with this feature/bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants