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

cabal-docspec fails if it cannot find ~/.cabal/config #136

Closed
RyanGlScott opened this issue Aug 23, 2023 · 3 comments
Closed

cabal-docspec fails if it cannot find ~/.cabal/config #136

RyanGlScott opened this issue Aug 23, 2023 · 3 comments

Comments

@RyanGlScott
Copy link
Contributor

I am attempting to run cabal-docspec locally on a machine where my cabal configuration is located at ~/.config/cabal/config, which is now the default location with cabal-install-3.10 and later. When I do so, cabal-docspec fails with:

$ cabal-docspec
[   0.00001] ghc.info: ghc
[   0.00034] process.0.start: cwd=/tmp ghc --info
[   0.02450] peu.exception: SomeException
/home/ryanglscott/.cabal/config: withBinaryFile: does not exist (No such file or directory)

Presumably, it's looking for the configuration in ~/.cabal/config instead. Is there a way to tell cabal-docspec to look in a different location?

@RyanGlScott
Copy link
Contributor Author

RyanGlScott commented Aug 23, 2023

There is a way, although it's controlled by the cabal-install-parsers library, not by cabal-docspec itself. If you set the CABAL_CONFIG environment variable, e.g.,

$ export CABAL_CONFIG=~/.config/cabal/config

Then cabal-docspec will behave as expected.

@RyanGlScott
Copy link
Contributor Author

Also, make sure that your ~/.config/cabal/config file explicitly defines the store-dir location, e.g.,

store-dir: /home/ryanglscott/.local/state/cabal/store

If it doesn't define store-dir, then cabal-install-parsers will default to ~/.cabal/store, which isn't where the cabal store is located by default with cabal-install-parsers-3.10+. This will lead to confusing errors when using cabal-docspec that look like:

[  10.07491] debug: stderr:
<command line>: cannot satisfy -package-id comonad-6-inplace: 
    comonad-6-inplace is unusable due to missing dependencies:
      indexed-traversable-0.1.2.1-0505391f249b00d3d49b7c397ce20702cb416ce0667632bc3d065696e2a95ddb tagged-0.8.8-0a00515bf4d9c16b0038b5a06fbb7b9c3d11beeeb5c2f10e7a03cad02a091e24
    (use -v for more information)

[  10.07607] debug: stdout:

[  10.07617] peu.die: Failure while starting GHCi: ExitFailure 1
proci: canceling
proci: terminating
proci: pid Nothing
proci: waiting for termination

@RyanGlScott
Copy link
Contributor Author

haskell-CI/haskell-ci#655 is an upstream issue about cabal-install-parsers not supporting XDG-style paths.

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