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 script needs network to work normally? #5103

Closed
diqye opened this issue Nov 26, 2019 · 4 comments
Closed

stack script needs network to work normally? #5103

diqye opened this issue Nov 26, 2019 · 4 comments

Comments

@diqye
Copy link

diqye commented Nov 26, 2019

The following file:

#!/usr/bin/env stack
{- stack --resolver global runghc
 --package process
 -}
{-# LANGUAGE OverloadedStrings #-}

main = do
  putStrLn "hello"

run command : stack xx.hs

Error reported in case of without network

HttpExceptionRequest Request {
  host                 = "mirrors.tuna.tsinghua.edu.cn"
  port                 = 80
  secure               = False
  requestHeaders       = [("Accept","application/json"),("User-Agent","The Haskell Stack")]
  path                 = "/stackage/snapshots.json"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}
 (ConnectionFailure Network.Socket.getAddrInfo (called with preferred socket type/protocol: AddrInfo {addrFlags = [AI_ADDRCONFIG], addrFamily = AF_UNSPEC, addrSocketType = Stream, addrProtocol = 0, addrAddress = <assumed to be undefined>, addrCanonName = <assumed to be undefined>}, host name: Just "mirrors.tuna.tsinghua.edu.cn", service name: Just "80"): does not exist (nodename nor servname provided, or not known))

expect: to work without network connection

@qrilka
Copy link
Contributor

qrilka commented Nov 26, 2019

@ppzzppz this seems to be an bug with an easy fix if the point is about the global resolver, see https://github.com/commercialhaskell/stack/blob/stable/src/Stack/Config.hs#L153 - snapshots are not used for the ARGlobal value.
PR with a fix will be welcomed.

@diqye
Copy link
Author

diqye commented Nov 27, 2019

I have tried and find that only “resolver global” doesn’t meet our expectation. The problem doesn’t seem too difficult, and I will try to fix

@qrilka
Copy link
Contributor

qrilka commented Nov 27, 2019

Much appreciated, let me know if I could help with it

@snoyberg
Copy link
Contributor

snoyberg commented Jan 7, 2020

Resolved by #5104, thanks!

@snoyberg snoyberg closed this as completed Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants