File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11## Unreleased changes
22
33* Added the ` --docker-env ` argument, to set environment variables in Docker container.
4+ * Set ` LC_ALL ` to UTF-8 encoding for builds to avoid "commitBuffer: invalid argument" errors from GHC [ #793 ] ( https://github.com/commercialhaskell/stack/issues/793 )
45
56## 0.1.3.1
67
Original file line number Diff line number Diff line change @@ -388,6 +388,7 @@ executePlan menv bopts baseConfigOpts locals sourceMap installedMap plan = do
388388 { esIncludeLocals = True
389389 , esIncludeGhcPackagePath = True
390390 , esStackExe = True
391+ , esLocaleUtf8 = False
391392 }
392393 forM_ (boptsExec bopts) $ \ (cmd, args) -> do
393394 $ logProcessRun cmd args
@@ -642,6 +643,7 @@ withSingleContext ActionContext {..} ExecuteEnv {..} task@Task {..} msuffix inne
642643 { esIncludeLocals = taskLocation task == Local
643644 , esIncludeGhcPackagePath = False
644645 , esStackExe = False
646+ , esLocaleUtf8 = True
645647 }
646648 getRunhaskellPath <- runOnce $ liftIO $ join $ findExecutable menv " runhaskell"
647649 getGhcjsPath <- runOnce $ liftIO $ join $ findExecutable menv " ghcjs"
@@ -941,6 +943,7 @@ singleTest topts lptb ac ee task installedMap =
941943 { esIncludeLocals = taskLocation task == Local
942944 , esIncludeGhcPackagePath = True
943945 , esStackExe = True
946+ , esLocaleUtf8 = False
944947 }
945948 if exists
946949 then do
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ defaultEnvSettings = EnvSettings
3131 { esIncludeLocals = True
3232 , esIncludeGhcPackagePath = True
3333 , esStackExe = True
34+ , esLocaleUtf8 = False
3435 }
3536
3637-- | Environment settings which do not embellish the environment
@@ -39,6 +40,7 @@ plainEnvSettings = EnvSettings
3940 { esIncludeLocals = False
4041 , esIncludeGhcPackagePath = False
4142 , esStackExe = False
43+ , esLocaleUtf8 = False
4244 }
4345
4446-- | Execute a process within the Stack configured environment.
Original file line number Diff line number Diff line change @@ -465,6 +465,7 @@ execOptsParser mcmd =
465465 " stack-exe"
466466 " setting the STACK_EXE environment variable to the path for the stack executable"
467467 idm
468+ <*> pure False
468469
469470 eoPackagesParser :: Parser [String ]
470471 eoPackagesParser = many (strOption (long " package" <> help " Additional packages that must be installed" ))
Original file line number Diff line number Diff line change @@ -216,6 +216,10 @@ setupEnv mResolveMissingGHC = do
216216 then Map. insert " STACK_EXE" (T. pack executablePath)
217217 else id )
218218
219+ $ (if esLocaleUtf8 es
220+ then Map. insert " LC_ALL" " C.UTF-8"
221+ else id )
222+
219223 -- For reasoning and duplication, see: https://github.com/fpco/stack/issues/70
220224 $ Map. insert " HASKELL_PACKAGE_SANDBOX" (T. pack $ toFilePathNoTrailingSlash deps)
221225 $ Map. insert " HASKELL_PACKAGE_SANDBOXES"
Original file line number Diff line number Diff line change @@ -190,6 +190,8 @@ data EnvSettings = EnvSettings
190190 -- ^ include the GHC_PACKAGE_PATH variable
191191 , esStackExe :: ! Bool
192192 -- ^ set the STACK_EXE variable to the current executable name
193+ , esLocaleUtf8 :: ! Bool
194+ -- ^ set the locale to C.UTF-8
193195 }
194196 deriving (Show , Eq , Ord )
195197
@@ -872,6 +874,7 @@ getMinimalEnvOverride = do
872874 { esIncludeLocals = False
873875 , esIncludeGhcPackagePath = False
874876 , esStackExe = False
877+ , esLocaleUtf8 = False
875878 }
876879
877880getWhichCompiler :: (MonadReader env m , HasEnvConfig env ) => m WhichCompiler
You can’t perform that action at this time.
0 commit comments