-
Notifications
You must be signed in to change notification settings - Fork 698
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
find sandbox from an environment variable #1800
Comments
You can set That being said, this looks like a bug in /cc @benarmston |
I can't reproduce the bug. Instead of installing cabal prints an error message and exits: $ cabal install hlint
cabal: Use of GHC's environment variable GHC_PACKAGE_PATH is incompatible with
Cabal. Use the flag --package-db to specify a package database (it can be used
multiple times). If I unset So it would seem that we have two issues to fix here:
|
Inside a cabal exec environment cabal should be configured to always use the correct environment. When there is a sandbox this is addressed by setting the CABAL_SANDBOX_CONFIG environment variable. However GHC is configured to use the correct package database through setting the GHC_PACKAGE_PATH environment variable to include the sandbox database. The Cabal library previously refused to operate when GHC_PACKAGE_PATH is set in order to avoid having a different view of the package databases to GHC. In the case of a cabal exec environment being loaded for a cabal sandbox, it is safe to allow the use of GHC_PACKAGE_PATH as it is being used to ensure that GHC uses the same package database as cabal does. A check is made that GHC_PACKAGE_PATH matches the value that cabal exec set it to. If it does use of GHC through cabal is permitted. Fixes haskell#1800
Inside a cabal exec environment cabal should be configured to always use the correct environment. When there is a sandbox this is addressed by setting the CABAL_SANDBOX_CONFIG environment variable. However GHC is configured to use the correct package database through setting the GHC_PACKAGE_PATH environment variable to include the sandbox database. The Cabal library previously refused to operate when GHC_PACKAGE_PATH is set in order to avoid having a different view of the package databases to GHC. In the case of a cabal exec environment being loaded for a cabal sandbox, it is safe to allow the use of GHC_PACKAGE_PATH as it is being used to ensure that GHC uses the same package database as cabal does. A check is made that GHC_PACKAGE_PATH matches the value that cabal exec set it to. If it does use of GHC through cabal is permitted. Fixes haskell#1800
Inside a cabal exec environment cabal should be configured to always use the correct environment. When there is a sandbox this is addressed by setting the CABAL_SANDBOX_CONFIG environment variable. However GHC is configured to use the correct package database through setting the GHC_PACKAGE_PATH environment variable to include the sandbox database. The Cabal library previously refused to operate when GHC_PACKAGE_PATH is set in order to avoid having a different view of the package databases to GHC. In the case of a cabal exec environment being loaded for a cabal sandbox, it is safe to allow the use of GHC_PACKAGE_PATH as it is being used to ensure that GHC uses the same package database as cabal does. A check is made that GHC_PACKAGE_PATH matches the value that cabal exec set it to. If it does use of GHC through cabal is permitted. Fixes haskell#1800
Currently, sandbox aware commands (such as
cabal install
) look for a sandbox in the current directory. I think it would be nice if there was an environment variable (e.g.CABAL_SANDBOX_PATH
) that cabal examines in order to determine the path of the sandbox. This would allow a sandbox to be used while working in a directory different than the one wherecabal sandbox init
was issued from.Here's an example scenario:
With cabal 1.20, the last command will install the package in
~/.cabal
, despite the fact that we are inside a cabal exec environment.hsenv
handles the above situation nicely; once you enter an hsenv environment, you can issue acabal install
from any directory.The text was updated successfully, but these errors were encountered: