Skip to content

Commit

Permalink
Warn on missing PATH in Docker image (fixes #2742)
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Mar 27, 2019
1 parent f0b66a1 commit 61ee5e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ Other enhancements:
* environment variable `GHC_ENVIRONMENT` is set to specify dependency
packages explicitly when running test. This is done to prevent
ambiguous module name errors in `doctest` tests.
* Warn when a Docker image does not include a `PATH` environment
variable. See
[#2472](https://github.com/commercialhaskell/stack/issues/2742)

Bug fixes:

Expand Down
6 changes: 5 additions & 1 deletion src/Stack/Docker.hs
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,15 @@ runContainerAndExit = do
-- in place for now, for users who haven't upgraded yet.
(isTerm || (isNothing bamboo && isNothing jenkins))
hostBinDirPath <- parseAbsDir hostBinDir
let mpath = T.pack <$> lookupImageEnv "PATH" imageEnvVars
when (isNothing mpath) $ do
logWarn "The Docker image does not set the PATH env var"
logWarn "This will likely fail, see https://github.com/commercialhaskell/stack/issues/2742"
newPathEnv <- either throwM return $ augmentPath
( toFilePath <$>
[ hostBinDirPath
, sandboxHomeDir </> relDirDotLocal </> relDirBin])
(T.pack <$> lookupImageEnv "PATH" imageEnvVars)
mpath
(cmnd,args,envVars,extraMount) <- getCmdArgs docker imageInfo isRemoteDocker
pwd <- getCurrentDir
liftIO
Expand Down

0 comments on commit 61ee5e5

Please sign in to comment.