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

Stack moving Git clones under .stack/downloads/ from their .tmp names causes build problems #2133

da-x opened this issue May 12, 2016 · 1 comment


Copy link

@da-x da-x commented May 12, 2016

The following issue happens with Version 1.1.0, Git revision 752100285335b2f18a3fec0039bd0581e8c25468 (3546 commits) x86_64 hpack-0.13.0 using Git 2.8.1.

When trying to build Lamdu which has a stack.yaml having a Git dependency over another package that has a submodule, I got the following:

--  While building package bindings-freetype-gl- using:
      /home/dan/dev/gh/da-x/lamdu/.stack-work/downloaded/22e1318b53013f3cd452538c0584632668207c3d460c75655f8c68a588e92f4b/.stack-work/dist/x86_64-linux/Cabal- --builddir=.stack-work/dist/x86_64-linux/Cabal- build lib:bindings-freetype-gl --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1
    Logs have been written to: /home/dan/dev/gh/da-x/lamdu/.stack-work/logs/bindings-freetype-gl-

    Configuring bindings-freetype-gl-
    fatal: Not a git repository: /home/dan/dev/gh/da-x/lamdu/.stack-work/downloaded/22e1318b53013f3cd452538c0584632668207c3d460c75655f8c68a588e92f4b.tmp/.git/modules/freetype-gl
    Unable to find current revision in submodule path 'freetype-gl'

Looking into this, I've discovered that Stack clones the Git repo to the path of 22e1318b53013f3cd452538c0584632668207c3d460c75655f8c68a588e92f4b.tmp, and then moves it to 22e1318b53013f3cd452538c0584632668207c3d460c75655f8c68a588e92f4b, i.e. removing the .tmp. However, the problem is that under the clone, the .git files pointing to the submodule repo contain absolute paths - the ones that existed used when the repo was originally cloned - with the .tmp name.

I fixed it manually by finding the submodules. The following lists both the clones and their submodules:

$ find .stack-work -name .git  

The problem is here:

$ cat .stack-work/downloaded/22e1318b53013f3cd452538c0584632668207c3d460c75655f8c68a588e92f4b/freetype-gl/.git
gitdir: /home/dan/dev/gh/da-x/lamdu/.stack-work/downloaded/22e1318b53013f3cd452538c0584632668207c3d460c75655f8c68a588e92f4b.tmp/.git/modules/freetype-gl

So I edited the 3 submodules shown above, and got around it temporarily.

I guess that the fix would be to mind the submodules somehow. Maybe not move the clone, or by fixing the paths in the .git files after moving them? Or, perhaps consulting with the authors of Git in order to figure out how to freely move Git clones around. I wonder why they decided to use absolute paths? Maybe there's a way to run the clone command in a way that does not generate these absolute paths.

Just trying it outside of Stack:

$ mkdir ~/some-git-clone-test
$ cd  ~/some-git-clone-test
$ git clone --recurse
$ cat bindings-freetype-gl/freetype-gl/.git
gitdir: /home/dan/some-git-clone-test/bindings-freetype-gl/.git/modules/freetype-gl

Looks like it's default behavior for now :(. Saw nothing in the man page for it. Can dig into the Git repo of Git but I have other things to do.

Copy link

@mgsloan mgsloan commented May 13, 2016

Good point! Fixed on master along with #1620 . Please let me know if it doesn't work.

@mgsloan mgsloan closed this May 13, 2016
@mgsloan mgsloan added this to the P1: Must milestone May 13, 2016
mgsloan added a commit that referenced this issue May 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants