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

install-method and overwrite-policy in .cabal/config are ignored #5942

Closed
maoe opened this issue Mar 16, 2019 · 10 comments · Fixed by #6100
Closed

install-method and overwrite-policy in .cabal/config are ignored #5942

maoe opened this issue Mar 16, 2019 · 10 comments · Fixed by #6100

Comments

@maoe
Copy link
Member

maoe commented Mar 16, 2019

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.

@fgaz
Copy link
Member

fgaz commented Mar 17, 2019

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

@fgaz fgaz self-assigned this Mar 17, 2019
@fgaz fgaz added this to Needs triage in fgaz works on cabal via automation Mar 17, 2019
@fgaz fgaz moved this from Needs triage to In progress ⏳ in fgaz works on cabal Mar 17, 2019
@fgaz
Copy link
Member

fgaz commented Mar 23, 2019

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.

@benjaminselfridge
Copy link

@fgaz Any update on this?

@fgaz
Copy link
Member

fgaz commented Apr 17, 2019

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

@fgaz fgaz moved this from In progress ⏳ to High priority 🔥 in fgaz works on cabal Jun 20, 2019
@typedrat typedrat added this to To Do in 2 typed 2 rat (GSOC 2k19) via automation Jun 21, 2019
@typedrat typedrat self-assigned this Jun 22, 2019
fgaz works on cabal automation moved this from High priority 🔥 to Done ✅ Jun 22, 2019
2 typed 2 rat (GSOC 2k19) automation moved this from To Do to Done Jun 22, 2019
@saurabhkukade
Copy link

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.

@phadej
Copy link
Collaborator

phadej commented May 14, 2020

-- starts a comment line.

@andy0130tw
Copy link

andy0130tw commented Aug 14, 2020

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.

@fgaz
Copy link
Member

fgaz commented Aug 14, 2020

@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

@andy0130tw
Copy link

@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.

@fgaz
Copy link
Member

fgaz commented Aug 19, 2020

@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

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

Successfully merging a pull request may close this issue.

7 participants