summaryrefslogtreecommitdiff
path: root/compiler/GHC/SysTools/BaseDir.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-11-29 16:12:59 -0500
committerBen Gamari <ben@smart-cactus.org>2021-12-03 12:55:34 -0500
commita4683970c103f0707d09ed2d0d0fca7408baed03 (patch)
treeac9dc7b5b08cee6c6cd9fd6295d7b2f4928d1f79 /compiler/GHC/SysTools/BaseDir.hs
parent14e9cab675f5b0abf2c303a0aa455237768103d1 (diff)
downloadhaskell-wip/T20757.tar.gz
compiler: Eliminate accidental loop in GHC.SysTools.BaseDirwip/T20757
As noted in #20757, `GHC.SysTools.BaseDir.findToolDir` previously contained an loop, which would be triggered in the case that the search failed. Closes #20757.
Diffstat (limited to 'compiler/GHC/SysTools/BaseDir.hs')
-rw-r--r--compiler/GHC/SysTools/BaseDir.hs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/GHC/SysTools/BaseDir.hs b/compiler/GHC/SysTools/BaseDir.hs
index c0a1fa2cee..5d86ee6925 100644
--- a/compiler/GHC/SysTools/BaseDir.hs
+++ b/compiler/GHC/SysTools/BaseDir.hs
@@ -196,11 +196,11 @@ findToolDir False top_dir = go 0 (top_dir </> "..") []
InstallationError $ "could not detect mingw toolchain in the following paths: " ++ show tried
| otherwise = do
let try = path </> "mingw"
- let tried = tried ++ [try]
+ let tried' = tried ++ [try]
oneLevel <- doesDirectoryExist try
if oneLevel
then return (Just path)
- else go (k+1) (path </> "..") tried
+ else go (k+1) (path </> "..") tried'
findToolDir True _ = return Nothing
#else
findToolDir _ _ = return Nothing