[commit: ghc] wip/nfs-locking: Avoid running commands with the Shell option, which breaks due to spaces in paths (f479c5d)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 01:27:35 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/f479c5d51dfee88abaad7dc3aeb19ea518948a19/ghc

>---------------------------------------------------------------

commit f479c5d51dfee88abaad7dc3aeb19ea518948a19
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sun Sep 17 00:41:12 2017 +0100

    Avoid running commands with the Shell option, which breaks due to spaces in paths
    
    * Fixes the docs build rule on Windows
    
    See #414


>---------------------------------------------------------------

f479c5d51dfee88abaad7dc3aeb19ea518948a19
 src/Builder.hs | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/Builder.hs b/src/Builder.hs
index 72cbb15..355878f 100644
--- a/src/Builder.hs
+++ b/src/Builder.hs
@@ -185,7 +185,7 @@ instance H.Builder Builder where
                     -- otherwise Windows breaks. TODO: Figure out why.
                     bash <- bashPath
                     let env = AddEnv "CONFIG_SHELL" bash
-                    cmd Shell echo env [Cwd dir] [path] buildOptions buildArgs
+                    cmd echo env [Cwd dir] ["sh", path] buildOptions buildArgs
 
                 HsCpp    -> captureStdout
                 GenApply -> captureStdout
@@ -195,16 +195,15 @@ instance H.Builder Builder where
                     Stdout stdout <- cmd (Stdin stdin) [path] buildArgs
                     writeFileChanged output stdout
 
-                Make dir -> cmd Shell echo path ["-C", dir] buildArgs
+                Make dir -> cmd echo path ["-C", dir] buildArgs
 
                 Xelatex -> do
-                    unit $ cmd Shell [Cwd output] [path] buildArgs
-                    unit $ cmd Shell [Cwd output] [path] buildArgs
-                    unit $ cmd Shell [Cwd output] [path] buildArgs
-                    unit $ cmd Shell [Cwd output] ["makeindex"]
-                                     (input -<.> "idx")
-                    unit $ cmd Shell [Cwd output] [path] buildArgs
-                    cmd Shell [Cwd output] [path] buildArgs
+                    unit $ cmd [Cwd output] [path]        buildArgs
+                    unit $ cmd [Cwd output] [path]        buildArgs
+                    unit $ cmd [Cwd output] [path]        buildArgs
+                    unit $ cmd [Cwd output] ["makeindex"] (input -<.> "idx")
+                    unit $ cmd [Cwd output] [path]        buildArgs
+                    unit $ cmd [Cwd output] [path]        buildArgs
 
                 _  -> cmd echo [path] buildArgs
 
@@ -226,7 +225,7 @@ systemBuilderPath builder = case builder of
     Cc  _  Stage0   -> fromKey "system-cc"
     Cc  _  _        -> fromKey "cc"
     -- We can't ask configure for the path to configure!
-    Configure _     -> return "sh configure"
+    Configure _     -> return "configure"
     Ghc _  Stage0   -> fromKey "system-ghc"
     GhcPkg _ Stage0 -> fromKey "system-ghc-pkg"
     Happy           -> fromKey "happy"
@@ -266,7 +265,7 @@ applyPatch dir patch = do
     needBuilder Patch
     path <- builderPath Patch
     putBuild $ "| Apply patch " ++ file
-    quietly $ cmd Shell [Cwd dir] [path, "-p0 <", patch]
+    quietly $ cmd [Cwd dir, FileStdin file] [path, "-p0"]
 
 -- | Install a directory.
 installDirectory :: FilePath -> Action ()



More information about the ghc-commits mailing list