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 fails on Windows with git package in stack.yaml and no git binary on path #712

Closed
conklech opened this Issue Aug 3, 2015 · 5 comments

Comments

Projects
None yet
2 participants
@conklech

conklech commented Aug 3, 2015

On a Windows system with no git on the system/user %PATH% and a git repository package in stack.yaml, stack (sometimes?) completely fails within the project folder.

$ cat stack.yaml
[...]
- location:
    git: https://github.com/conklech/threepenny-gui.git
    commit: b426b55bc34704b66da35b256c3e7505b044b636
$ stack build
Executable named git not found on path: ["C:\\ProgramData\\Oracle\\Java\\javapath","C:\\Windows\\system32","C:\\Windows","C:\\Windows\\System32\\Wbem","C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\","C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common","%SystemRoot%\\system32","%SystemRoot%","%SystemRoot%\\System32\\Wbem","%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\","C:\\Users\\chris\\AppData\\Roaming\\local\\bin"]
$ stack exec -- echo "nothing"
Executable named git not found on path: ["C:\\ProgramData\\Oracle\\Java\\javapath","C:\\Windows\\system32","C:\\Windows","C:\\Windows\\System32\\Wbem","C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\","C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common","%SystemRoot%\\system32","%SystemRoot%","%SystemRoot%\\System32\\Wbem","%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\","C:\\Users\\chris\\AppData\\Roaming\\local\\bin"]
$ cd ..
$ stack exec -- where git
Run from outside a project, using implicit global config
Using resolver: lts-2.20 from global config file: C:\Users\chris\AppData\Roaming\stack\global\stack.yaml
C:\Users\chris\AppData\Local\Programs\stack\i386-windows\git-2.4.5.1\cmd\git.exe

This condition is fragile. After adding git.exe to the %PATH% and running stack build (which succeeds), and then opening a new shell with the original %PATH%, stack functions normally again, even after stack clean. I don't know what the exact preconditions for the buggy behavior are.

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Aug 5, 2015

Are you using a system-installed GHC in this case?

What is the resolution you're proposing here? Obviously git is necessary in order to execute the build plan.

@snoyberg snoyberg added this to the 0.3.0.0 milestone Aug 5, 2015

@conklech

This comment has been minimized.

conklech commented Aug 5, 2015

No, there is no system-installed ghc or git.

The stack copy of git is available (see last line of log) and can be run via stack exec, but stack isn't looking in %LOCALAPPDATA%\Programs\stack\...\git-*\cmd\ when it tries to run git within the project directory (it's not in the list of folders following "Executable named git not found on path:"). I could have made the report clearer on that point; sorry.

The requested resolution is for stack to use the git installed via stack setup in all cases when there is no system git. Its folder should be added to (the end of?) the search path.

snoyberg added a commit that referenced this issue Aug 5, 2015

Perform package resolving with modified environment #712
This allows the Git installed by `stack setup` to be used

@snoyberg snoyberg self-assigned this Aug 5, 2015

@snoyberg snoyberg added the in progress label Aug 5, 2015

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Aug 5, 2015

Thanks, that clarifies. I've just pushed a commit to the 712-clone-modified-env branch that should resolve this. Can you give it a try and, if it works correctly for you, I'll merge to master and close out this issue.

@snoyberg snoyberg modified the milestones: 0.2.0.0, 0.3.0.0 Aug 5, 2015

@conklech

This comment has been minimized.

conklech commented Aug 5, 2015

Works perfectly. Thanks!

@snoyberg

This comment has been minimized.

Contributor

snoyberg commented Aug 5, 2015

Cool, merged to master.

@snoyberg snoyberg closed this Aug 5, 2015

@snoyberg snoyberg removed the in progress label Aug 5, 2015

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