haskell-vim-now icon indicating copy to clipboard operation
haskell-vim-now copied to clipboard

Stack setup fails when stack needs upgrading

Open odcameron opened this issue 3 years ago • 2 comments

When first installing Haskell-Vim-Now I encountered the following error:

Setting up GHC if needed...
Stack setup failed with exit code: 1
stderr: RedownloadInvalidResponse Request {
  host                 = "raw.githubusercontent.com"
  port                 = 443
  secure               = True
  requestHeaders       = []
  path                 = "/fpco/lts-haskell/master//lts-19.11.yaml"
  queryString          = ""
  method               = "GET"
  proxy                = Nothing
  rawBody              = False
  redirectCount        = 10
  responseTimeout      = ResponseTimeoutDefault
  requestVersion       = HTTP/1.1
}

The error was caused by an older version of stack which requested to download from an outdated Github URL ("raw.githubusercontent.com/fpco/lts-haskell/master//lts-19.11.yaml"). Upon executing ..$ sudo stack upgrade then reattempting to install (..$ bash /tmp/haskell-vim-now.sh) the installation proceeded with success.

Recommend adding something like the following lines in the "setup_haskell.hs" file just before msg "Setting up GHC if needed...:

msg "   Upgrading stack if needed"
Turtle.procStrict "stack" ["upgrade"]  $  pure (Turtle.unsafeTextToLine "y") 

odcameron avatar Oct 06 '22 10:10 odcameron

Thanks for the report.

Recommend adding something like the following lines in the "setup_haskell.hs" file just before msg "Setting up GHC if needed...:

msg "   Upgrading stack if needed"
Turtle.procStrict "stack" ["upgrade"]  $  pure (Turtle.unsafeTextToLine "y") 

Are you able to revert your system to reproduce the error, and then test whether this addition fixes it? If that works, then I'd accept a pull request.

Also, might it be an unwelcome surprise to someone that their Stack gets upgraded without their confirmation?

begriffs avatar Oct 06 '22 15:10 begriffs

Thanks @begriffs , I will get back to you after I have a chance to test. And you make a fair point about automatically upgrading Stack: I know several Haskell packages are quite sensitive to which version of GHC is being used (is this the issue which causes "Cabal Hell"?) and upgrading my Stack did change to GHC version which Stack tried to install. As such, would you support an interactive installer confirmation (ie. not passing "y" automatically but asking the user)?

odcameron avatar Oct 07 '22 00:10 odcameron