commercialhaskell / commercialhaskell/stack
Stack fails when running in a clean environment
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
I was trying to run stack using a clean environment (`env -i`) and found a couple of issues:
- Stack depends on `$HOME`.
```
cueball$ env -i ~/.local/bin/stack runghc hello.hs
HOME: getAppUserDataDirectory: does not exist (no environment variable)
```
This could be avoided if we use `getUserEntryForID` instead of getEnv("HOME").
- On Mac it depends on `security` to be available on your path. If I remove /usr/bin from path stack in unable to run:
```
wickedwench$ env -i PATH= ~/.local/bin/stack runghc hello.hs
security: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
```
Not sure why we need this. I would like to know if somebody knows it. If we are dependent on other tools we can perhaps _append_ the usual places to PATH internally rather than relying completely on the user's setting. Of course the user is responsible to have stack itself on the PATH if stack is being used as an interpreter.
I use Haskell for scripting and stack as the interpreter in some of my scripts. I want some of the scripts to run with a clean environment to make sure that they will work the same irrespective of where and how they are run. Random user env settings should not impact the scripts ability to run as long as possible.
Contributor guide
Assessment
This issue has not been assessed yet.