summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2019-10-01 16:23:27 -0400
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-11-04 03:40:31 -0500
commit3b65655c4cef5407829ed41707c48be2f8b3b340 (patch)
tree8d253c35360ff72225e40ad4be21f9a1d7e12a0f
parent3c9161621c6e467f53c5d4649a3c54b3cb40fbf9 (diff)
downloadhaskell-3b65655c4cef5407829ed41707c48be2f8b3b340.tar.gz
SysTools: Only apply Windows-specific workaround on Windows
Issue #1110 was apparently due to a bug in Vista which prevented GCC from finding its binaries unless we explicitly added it to PATH. However, this workaround was incorrectly applied on non-Windows platforms as well, resulting in ill-formed PATHs (#17266). Fixes #17266.
-rw-r--r--compiler/main/SysTools/Process.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/main/SysTools/Process.hs b/compiler/main/SysTools/Process.hs
index 2e0e502b63..7ad2cf2f53 100644
--- a/compiler/main/SysTools/Process.hs
+++ b/compiler/main/SysTools/Process.hs
@@ -83,16 +83,22 @@ getGccEnv opts =
if null b_dirs
then return Nothing
else do env <- getEnvironment
- return (Just (map mangle_path env))
+ return (Just (mangle_paths env))
where
(b_dirs, _) = partitionWith get_b_opt opts
get_b_opt (Option ('-':'B':dir)) = Left dir
get_b_opt other = Right other
+ -- Work around #1110 on Windows only (lest we stumble into #17266).
+#if defined(mingw32_HOST_OS)
+ mangle_paths = map mangle_path
mangle_path (path,paths) | map toUpper path == "PATH"
= (path, '\"' : head b_dirs ++ "\";" ++ paths)
mangle_path other = other
+#else
+ mangle_paths = id
+#endif
-----------------------------------------------------------------------------