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

Exit with an error if $CABAL_SANDBOX_CONFIG does not point to extant file #2680

Merged

Conversation

BardurArantsson
Copy link
Collaborator

I think this fixes #2224. I haven't done extensive manual testing, but the tests all (obviously) still pass.

Example output:

cabal: Cabal sandbox file in $CABAL_SANDBOX_CONFIG does not exist: foo

the "foo" is the content of the env variable.

I should note that the error occurs quite "aggressively", i.e. when the settings are read, and not when they are actually used -- so even things like "cabal info" will fail if the env variable is invalid. I think a more relaxed would be a lot more error-prone since it would be easy to miss cases.

@BardurArantsson
Copy link
Collaborator Author

Hm. I see there are some actual possibly-real failures here. I'll investigate tomorrow.

@BardurArantsson BardurArantsson force-pushed the sandbox-config-does-not-exist branch from bedb68e to 3488f59 Compare July 2, 2015 06:29
@BardurArantsson
Copy link
Collaborator Author

Ah, yes, FTP.

Alright, I think this should be good to go.

dcoutts added a commit that referenced this pull request Jul 7, 2015
…-exist

Exit with an error if $CABAL_SANDBOX_CONFIG does not point to extant file
@dcoutts dcoutts merged commit 71edb7d into haskell:master Jul 7, 2015
@BardurArantsson BardurArantsson deleted the sandbox-config-does-not-exist branch July 15, 2015 10:24
@edsko
Copy link
Contributor

edsko commented Sep 15, 2015

I've submitted a PR that undoes this commit, because it makes cabal completely unusable when CABAL_SANDBOX_CONFIG is set. This check happens much too early, so that for instance we get

# ../dist/build/cabal/cabal sandbox init
cabal: Cabal sandbox file in $CABAL_SANDBOX_CONFIG does not exist:
./cabal.sandbox.config-7.8.4

Moreover, even if we initialize the sandbox using an older cabal

# ~/opt/cabal/cabal-1.22.0.0 sandbox init
Writing a default package environment file to ./cabal.sandbox.config-7.8.4
Creating a new sandbox at
/Users/e/wt/projects/tuf/cabal/cabal-install/t/.cabal-sandbox

trying to install any packages into the sandbox fails:

# ../dist/build/cabal/cabal install mtl
Resolving dependencies...
Notice: installing into a sandbox located at
/Users/e/wt/projects/tuf/cabal/cabal-install/t/.cabal-sandbox
Configuring transformers-0.4.3.0...
Failed to install transformers-0.4.3.0
Build log ( /Users/e/wt/projects/tuf/cabal/cabal-install/t/.cabal-sandbox/logs/transformers-0.4.3.0.log ):
cabal: Cabal sandbox file in $CABAL_SANDBOX_CONFIG does not exist:
./cabal.sandbox.config-7.8.4
cabal: Error: some packages failed to install:
mtl-2.2.1 depends on transformers-0.4.3.0 which failed to install.
transformers-0.4.3.0 failed during the configure step. The exception was:
ExitFailure 1

@BardurArantsson
Copy link
Collaborator Author

Absolutely fair enough to just revert. I guess my testing wasn't sufficient :(. I guess this is really a cue that we really need to expand the test suite and to make it easier to add tests.

(I don't think I'll get around to implementing this properly any time soon.)

@BardurArantsson BardurArantsson self-assigned this Oct 15, 2015
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

Successfully merging this pull request may close these issues.

CABAL_SANDBOX_CONFIG error handling
3 participants