commercialhaskell / commercialhaskell/stack
Many --nix command do not forward the https?_proxy environment variables to the inner command
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
### General summary/comments (optional)
opening an issue because i'm not sure if i'm doing something stupid and this is my fault or not.
Running on centos 6
It seems like the globalManager isn't respecting the http_proxy and https_proxy env variables. I'm not completely sure though since I'm a n00b with this.
I'm trying to build yi, and when I run stack setup it seems unable to fetch defaultStackSetupYaml and the request times out in getSetupInfo.
I hackily added (copy pasted from http-client then added the managerSetProxy call)
```
globalManager :: IORef Manager
globalManager = unsafePerformIO $ do
context <- NC.initConnectionContext
let settings = managerSetProxy (proxyEnvironment Nothing) $ mkManagerSettingsContext (Just context) def Nothing
manager <- newManager settings
newIORef manager {-# NOINLINE globalManager #-}
```
to src/main/Main.hs, rebuilt stack, and successfully fetched the yaml file with
```
do {req <- parseRequest defaultStackSetupYaml; man <- getGlobalManager; httpLbs req man >>= print}
```
after including `Network.HTTP.Client.TLS Data.IORef System.IO.Unsafe Data.Default.Class` in ghci and in the executable in stack.cabal. (fetching the defaultStackSetupYaml does not work in ghci without my modifications to globalManager.)
Any help would be appreciated!
### Steps to reproduce
Run stack setup (my stack is currently on ghc 7.10 and am trying to update to 8) in yi's homedir.
### Expected
The request to respect the proxy and go through.
### Actual
```
stack setup -v
Version 1.2.1, Git revision a11c2c2c43f779c6fe7086a2e4c8d974305609a0 (dirty) (4178 commits) x86_64 hpack-0.14.1
2016-10-04 19:07:17.670482: [debug] Checking for project config at: /home/justinchiu/haskell/yi/stack.yaml
@(Stack/Config.hs:819:9)
2016-10-04 19:07:17.670714: [debug] Loading project config file stack.yaml
@(Stack/Config.hs:837:13)
2016-10-04 19:07:17.674091: [debug] Trying to decode /home/justinchiu/.stack/build-plan-cache/x86_64-linux/nightly-2016-07-31.cache
@(Data/Store/VersionTagged.hs:68:5)
2016-10-04 19:07:17.682562: [debug] Success decoding /home/justinchiu/.stack/build-plan-cache/x86_64-linux/nightly-2016-07-31.cache
@(Data/Store/VersionTagged.hs:72:13)
2016-10-04 19:07:17.683085: [debug] PATH is: Just "redacted"
@(Stack/Nix.hs:130:6)
2016-10-04 19:07:17.683215: [debug] Using a nix-shell environment from file: /home/justinchiu/haskell/yi/shell.nix
@(Stack/Nix.hs:131:6)
2016-10-04 19:07:17.683704: [debug] Run process: /home/justinchiu/.nix-profile/bin/nix-shell --pure /home/justinchiu/haskell/yi/shell.nix --arg ghc "with (import {}); haskell.compiler.ghc801" --run "'/home/justinchiu/.local/bin/stack' $STACK_IN_NIX_EXTRA_ARGS '--internal-re-exec-version=1.2.1' 'setup' '-v'"
@(Stack/Exec.hs:65:5)
Version 1.2.1, Git revision a11c2c2c43f779c6fe7086a2e4c8d974305609a0 (dirty) (4178 commits) x86_64 hpack-0.14.1
2016-10-04 19:07:19.494480: [debug] Checking for project config at: /home/justinchiu/haskell/yi/stack.yaml
@(Stack/Config.hs:819:9)
2016-10-04 19:07:19.494742: [debug] Loading project config file stack.yaml
@(Stack/Config.hs:837:13)
2016-10-04 19:07:19.507568: [debug] Trying to decode /home/justinchiu/.stack/build-plan-cache/x86_64-linux/nightly-2016-07-31.cache
@(Data/Store/VersionTagged.hs:68:5)
2016-10-04 19:07:19.513657: [debug] Success decoding /home/justinchiu/.stack/build-plan-cache/x86_64-linux/nightly-2016-07-31.cache
@(Data/Store/VersionTagged.hs:72:13)
2016-10-04 19:07:19.518049: [debug] Getting system compiler version
@(Stack/Setup.hs:354:17)
2016-10-04 19:07:19.518702: [debug] Run process: /nix/store/95s500qrn3h2ipvkkcxbn9q41gpjpbgh-ghc-7.10.3/bin/ghc --info
@(System/Process/Read.hs:306:3)
2016-10-04 19:07:19.582440: [debug] Process finished in 63ms: /nix/store/95s500qrn3h2ipvkkcxbn9q41gpjpbgh-ghc-7.10.3/bin/ghc --info
@(System/Process/Read.hs:306:3)
2016-10-04 19:07:19.585246: [debug] Run process: /sbin/ldconfig -p
@(System/Process/Read.hs:306:3)
2016-10-04 19:07:19.587780: [debug] Process finished in 2ms: /sbin/ldconfig -p
@(System/Process/Read.hs:306:3)
2016-10-04 19:07:19.588171: [debug] Run process: /nix/store/45qrn064f92kfxnjg99z39zxda671h6f-gcc-wrapper-5.4.0/bin/gcc -v
@(System/Process/Read.hs:306:3)
2016-10-04 19:07:19.603318: [debug] Process finished in 14ms: /nix/store/45qrn064f92kfxnjg99z39zxda671h6f-gcc-wrapper-5.4.0/bin/gcc -v
@(System/Process/Read.hs:306:3)
2016-10-04 19:07:19.603563: [debug] Found shared library libtinfo.so.5 in 'ldconfig -p' output
@(Stack/Setup.hs:523:29)
2016-10-04 19:07:19.603984: [debug] Did not find shared library libtinfo.so.6
@(Stack/Setup.hs:537:38)
2016-10-04 19:07:19.604088: [debug] Did not find shared library libncursesw.so.6
@(Stack/Setup.hs:537:38)
2016-10-04 19:07:19.604222: [debug] Did not find shared library libgmp.so.10
@(Stack/Setup.hs:537:38)
2016-10-04 19:07:19.604305: [debug] Found shared library libgmp.so.3 in 'ldconfig -p' output
@(Stack/Setup.hs:523:29)
2016-10-04 19:07:19.604365: [debug] Using gmp4 GHC build
@(Stack/Setup.hs:569:9)
HttpExceptionRequest Request {
host = "raw.githubusercontent.com"
port = 443
secure = True
requestHeaders = []
path = "/fpco/stackage-content/master/stack/stack-setup-2.yaml"
queryString = ""
method = "GET"
proxy = Nothing
rawBody = False
redirectCount = 10
responseTimeout = ResponseTimeoutDefault
requestVersion = HTTP/1.1
}
ConnectionTimeout
```
### Stack version
``````
$ stack --version
Version 1.2.1, Git revision a11c2c2c43f779c6fe7086a2e4c8d974305609a0 (dirty) (4178 commits) x86_64 hpack-0.14.1```
### Method of installation
git clone stack...
stack install .
``````
Contributor guide
Assessment
This issue has not been assessed yet.