-
Notifications
You must be signed in to change notification settings - Fork 846
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
stack --work-dir
fails with directories above the current directory
#1731
Comments
It's this way intentionally, though certainly the error reporting could be better. See the discussion here - #1178 (comment) . The summary is that there is some cabal bug on windows that requires the dist dir to be within the package dir. This is why we have multiple stack-work directories, instead of just one. I would be in favor of putting everything in a .stack-work dir, if not on windows / not using affected Cabal versions. Then, we could also allow absolute directories for --work-dir, though I'm not sure how we would ensure that different projects sharing a work-dir wouldn't stomp on eachother. However, allowing absolute paths or |
I'm leaving this issue open to track making the error message better. If we want to unify .stack-work into a single dir for the project, allow absolute paths, or allow paths with ../, then that should go in a separate issue. |
@mgsloan I think this issue actually is caused by a built-in limitation in |
Also, see this discussion on the mailing list: https://groups.google.com/forum/#!topic/haskell-stack/YvO45vDw62o |
@magthe Right, but our usage of a function in If |
For me it's pretty much useless :( |
Yep. I would accept a patch that makes it useful by doing the following:
The main problem with this is that if you use one of these options in a script or something, suddenly it won't work on windows. We tend to try to avoid things like that which break cross-platform compatibility. Then again, this seems like a Cabal bug (not sure what the details are). Perhaps by exposing it to users, it'll get fixed sooner rather than later. |
👍 for accepting an absolute directory that's not a child of the project directory. I'm trying to replicate cabal sandbox functionality used here, where
The larger context is that I have to build a project in an temporary directory that is removed after building and install the project under |
Here's the workaround I've instituted for now - 1) copy over source, 2) build and install source, 3) copy back .stack-work directory. I've been looking through the sources to relax the Rel dir constraint - it seems pretty enmeshed currently and would also involve moving to a single work-dir, both things I'd be 👍 about. I don't know the project that well, but will play around with trying to move to an Abs dir while preserving a Rel dir on windows. |
More as an exercise, went through and threaded the work-dir as
Would love this kind of flexibility for configuring the work dir! |
@mfine Cool! I think the path library should have a better datatype for "may be either abs or relative". Then we can do a similar change more elegantly. Thoughts, @chrisdone / @mrkkrp ? |
@mgsloan definitely agree! Something that could express either and support |
@mfine What if the project has multiple packages, but I want to have single |
@phadej not sure in what context you think |
Due to an issue with Cabal on windows - #1178 (comment) - unfortunately this isn't going to be resolved. We could consider unifying the |
Steps to reproduce:
stack build --work-dir=../.stack-work
Expected:
The build proceeds using the
.stack-work
directory of the parent directoryActual:
Stack errors out with
Seems like this ought to work, right?
The text was updated successfully, but these errors were encountered: