cabal icon indicating copy to clipboard operation
cabal copied to clipboard

cabal sandbox paths default to not being relative paths

Open cartazio opened this issue 13 years ago • 14 comments

if i do

mkdir test
cd test
cabal sandbox init
cabal install void # or any other package
cd ..
mkdir test2
mv test test2/
cd test2/test
cabal install data-reify

i get

carter test2/test » cabal install data-reify
cabal: No sandbox exists at /Users/carter/test/.cabal-sandbox

this suggests to me that the default paths in the cabal sandbox config (for the data that is local to the sandbox) should be relative paths, because its very unintuitive that moving a sandbox breaks the config files

cartazio avatar Sep 08 '13 21:09 cartazio

hrmmm. seems like theres no support for relative paths currently in cabal, I tried changing the sandbox config file to use relative paths and cabal errored out

cartazio avatar Sep 08 '13 21:09 cartazio

Yes, that's a known limitation.

23Skidoo avatar Sep 08 '13 22:09 23Skidoo

I would like to be able to point to paths in ./cabal.config using $pwd/blah/blah

tonymorris avatar Jan 06 '14 00:01 tonymorris

@tonymorris where $pwd is the sandbox root directory?

cartazio avatar Jan 06 '14 00:01 cartazio

Yes, the directory containing cabal.config.

tonymorris avatar Jan 06 '14 00:01 tonymorris

+1

dmjio avatar May 08 '14 21:05 dmjio

+1

ryanoneill avatar Jun 23 '14 02:06 ryanoneill

+1

I faced that multiple time and that would be great to avoid all the manual editing...

aloiscochard avatar Jun 23 '14 12:06 aloiscochard

+1

A $pwd var would suffice.

ndemonner avatar Sep 21 '14 16:09 ndemonner

+1 Would make it easier to commit sandbox files and use them on different machines.

krauthaufen avatar Apr 30 '15 06:04 krauthaufen

Another use case: installing a package with cabal inside a Docker container.

langston-barrett avatar Jul 22 '15 04:07 langston-barrett

+1

sinelaw avatar Aug 12 '15 16:08 sinelaw

I've found a workaround: search/replace old path to new path in all .conf files, then run ghc-pkg recache on the package db of the sandbox:

find /path/to/.cabal-sandbox -iname "*.conf" -type f | xargs sed -i 's, /.*/\.cabal-sandbox, /path/to/.cabal-sandbox,g'
ls /path/to/.cabal-sandbox/ | grep 'conf\.d' | xargs -t -n1 -i_db_ ghc-pkg --package-db=/path/to/.cabal-sandbox/_db_ recache

Replace /path/to/.cabal-sandbox with your own path for the relocated sandbox.

sinelaw avatar Aug 12 '15 16:08 sinelaw

sandbox functionality is removed.

phadej avatar Aug 31 '20 10:08 phadej