Cabal: install-method and overwrite-policy in .cabal/config are ignored

Created on 16 Mar 2019  路  10Comments  路  Source: haskell/cabal

I have these settings in my ~/.cabal/config:

overwrite-policy: always
install-method: copy           
installdir: /Users/maoe/.local/bin

but overwrite-policy and install-method seem to be ignored:

% cabal install exe:cabal
Wrote tarball sdist to
/Users/maoe/src/github.com/haskell/cabal/dist-newstyle/sdist/Cabal-3.0.0.0.tar.gz
Wrote tarball sdist to
/Users/maoe/src/github.com/haskell/cabal/dist-newstyle/sdist/cabal-testsuite-3.0.0.0.tar.gz
Wrote tarball sdist to
/Users/maoe/src/github.com/haskell/cabal/dist-newstyle/sdist/cabal-install-3.0.0.0.tar.gz
Wrote tarball sdist to
/Users/maoe/src/github.com/haskell/cabal/dist-newstyle/sdist/solver-benchmarks-3.0.0.0.tar.gz
Wrote tarball sdist to
/Users/maoe/src/github.com/haskell/cabal/dist-newstyle/sdist/pretty-show-1.6.16.tar.gz
Resolving dependencies...
Up to date
Symlinking 'cabal'
cabal: Path '/Users/maoe/.local/bin/cabal' already exists. Use
--overwrite-policy=always to overwrite.

As you can see it tries to symlink cabal and --overwrite-policy=always seems to be ignored.

I'm using recent master (e23d8d1) of cabal-install.

nix-local-build bug

All 10 comments

Good catch! I think I know why it happens, should be quick to fix

So, this is more complex than I thought. Seems like those two flags, when absent, do not generate a NoFlag, but a Flag mempty, which overrides the configured one. Oddly, other new-install flags like --env-file, DO generate a NoFlag when absent.

@fgaz Any update on this?

@benjaminselfridge nope. I'ts next on my cabal todo list though

I am still facing this issue.
I have entry of flag in my ~/.cabal/config file as
-- overwrite-policy: always

but still cabal install is ignoring the flag.

-- starts a comment line.

The v2-configure / v2-build command with --prefix seems to have no effects. The default prefix $HOME/.cabal... is still used, and does not being written to cabal.project.local. It even does not go through path checkings, where it should complain on non-absolute paths.

@andy0130tw if I remember correctly --prefix is a Cabal-the-library flag, which does not have effect on cabal-install. It's only there in the --help because cabal-install _does_ accept some Cabal flags, so the whole set of options was put in there.

I might be wrong though. Did it have an effect on v1-build?

Also maybe --store-dir, which set the store directory, could be what you need

@fgaz: I was mainly compiling Agda and needed to specify datadir pointing to its libraries. Soon I realized that the --prefix argument is what I wanted. I used apt install in Debian Stretch, and there was only v1 in the repository.

Apparently, the prefix argument worked in v1, but not in v2 and later.

@andy0130tw

and needed to specify datadir pointing to its libraries. Soon I realized that the --prefix argument is what I wanted

Could you explain further? I'm not sure I understand the use case

edit: also I think you should open a separate issue for this, as it's a separate problem

Was this page helpful?
0 / 5 - 0 ratings