File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ Bug fixes:
31
31
* When building the sanity check for a new GHC install, make sure to clear
32
32
` GHC_PACKAGE_PATH ` .
33
33
* Specifying GHC RTS flags in the ` stack.yaml ` no longer fails with an error. [ #5568 ] ( https://github.com/commercialhaskell/stack/pull/5568 )
34
+ * ` stack setup ` will look in sandboxed directories for executables, not
35
+ relying on `findExecutables. See
36
+ [ GHC issue 20074] ( https://gitlab.haskell.org/ghc/ghc/-/issues/20074 )
34
37
35
38
## v2.7.1
36
39
Original file line number Diff line number Diff line change @@ -667,15 +667,26 @@ ensureSandboxedCompiler sopts getSetupInfo' = do
667
667
WCGhc version -> pure [" ghc-" ++ versionString version, " ghc" ]
668
668
WCGhcGit {} -> pure [" ghc" ]
669
669
WCGhcjs {} -> throwIO GhcjsNotSupported
670
+
671
+ -- Previously, we used findExecutable to locate these executables. This was
672
+ -- actually somewhat sloppy, as it could discover executables outside of the
673
+ -- sandbox. This led to a specific issue on Windows with GHC 9.0.1. See
674
+ -- https://gitlab.haskell.org/ghc/ghc/-/issues/20074. Instead, now, we look
675
+ -- on the paths specified only.
670
676
let loop [] = do
671
677
logError $ " Looked for sandboxed compiler named one of: " <> displayShow names
672
678
logError $ " Could not find it on the paths " <> displayShow (edBins paths)
673
679
throwString " Could not find sandboxed compiler"
674
680
loop (x: xs) = do
675
- res <- findExecutable x
681
+ res <- liftIO $ D. findExecutablesInDirectories ( map toFilePath (edBins paths)) x
676
682
case res of
677
- Left _ -> loop xs
678
- Right y -> parseAbsFile y
683
+ [] -> loop xs
684
+ compiler: rest -> do
685
+ unless (null rest) $ do
686
+ logWarn " Found multiple candidate compilers:"
687
+ for_ res $ \ y -> logWarn $ " - " <> fromString y
688
+ logWarn $ " This usually indicates a failed installation. Trying anyway with " <> fromString compiler
689
+ parseAbsFile compiler
679
690
compiler <- withProcessContext menv $ do
680
691
compiler <- loop names
681
692
You can’t perform that action at this time.
0 commit comments