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

hs-source-dirs starting with `../` are not included in the -i<dir> arguments when using `stack ghci file.hs` #2895

Closed
tallen-imvu opened this Issue Jan 4, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@tallen-imvu
Contributor

tallen-imvu commented Jan 4, 2017

Summary

stack ghci <target file> will correctly determine include directories using the cabal file's hs-source-dirs property unless the source directory starts with a ../
stack build however deals with this correctly.

Steps to reproduce

  1. add a relative path to hs-source-dirs:
    ex:
    hs-source-dirs: . ../extra

  2. Add a module to the ../extra directory and import it in your main file

  3. run command stack build
    everything should work

  4. run command stack ghci <path to main>

Expected

ghci launched with package loaded

Actual

Error in compiling due to failing to load the extra module. Because it cannot find it.

running the stack ghci command with --version shows that the ../extra directory is not being added to the list of -i<directory> flags passed to ghci.
If the module is moved to a directory that does not require a ../ prefix, then that directory is included properly.

Stack version

$ stack --version
Version 1.3.2, Git revision 3f675146590da4f3edf768b89355f798229da2a5 (4395 commits) x86_64 hpack-0.15.0

Method of installation

@mgsloan

This comment has been minimized.

Collaborator

mgsloan commented Jan 6, 2017

Hmm, I cannot reproduce the issue. For me if I have

library
  hs-source-dirs:      src ../issue2895-extra
  exposed-modules:     Lib Huh

It works (Huh.hs is in ../issue2895-extra). Perhaps your module is not listed in exposed-modules / other-modules?

@tallen-imvu

This comment has been minimized.

Contributor

tallen-imvu commented Jan 6, 2017

I put up a reproducing repo here

@tallen-imvu

This comment has been minimized.

Contributor

tallen-imvu commented Jan 13, 2017

Oh, there it is.
It is the parseRelDir on line 423 of src/Stack/Package.hs
Pull request incomming

mgsloan added a commit that referenced this issue Jan 31, 2017

Merge pull request #2920 from tallen-imvu/master
for 'stack ghci', don't omit hsSourceDirs that have '..' in them. #2895
@mgsloan

This comment has been minimized.

Collaborator

mgsloan commented Jan 31, 2017

Thanks for finding and fixing!!

@mgsloan mgsloan closed this Jan 31, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment