Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #6633 If not detached, always use Docker -i flag #6634

Merged
merged 1 commit into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .stan.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@

# Anti-pattern: Data.ByteString.Char8.pack
[[ignore]]
id = "OBS-STAN-0203-axv1UG-354:32"
id = "OBS-STAN-0203-axv1UG-347:32"
# ✦ Description: Usage of 'pack' function that doesn't handle Unicode characters
# ✦ Category: #AntiPattern
# ✦ File: src\Stack\Docker.hs
#
# 353
# 354 ┃ hashRepoName = Hash.hash . BS.pack . takeWhile (\c -> c /= ':' && c /= '@')
# 355 ┃ ^^^^^^^
# 346
# 347 ┃ hashRepoName = Hash.hash . BS.pack . takeWhile (\c -> c /= ':' && c /= '@')
# 348 ┃ ^^^^^^^

# Data types with non-strict fields
# Defining lazy fields in data types can lead to unexpected space leaks
Expand Down
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Behavior changes:
* Stack interprets consecutive line ends in the value of the `user-message`
project-specific configuration option as a single blank line. Previously all
line ends were interpreted as white space.
* Stack no longer supports Docker versions before Docker 1.9.1 and,
consequently, if a Docker container is not being run 'detached', its standard
input channel will always be kept open. (Before Docker 1.9.1 the use of an
interactive container could hang in certain circumstances.)

Other enhancements:

Expand Down
9 changes: 1 addition & 8 deletions src/Stack/Docker.hs
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,6 @@ runContainerAndExit = do
isStdoutTerminal <- view terminalL
let dockerHost = lookup "DOCKER_HOST" env
dockerCertPath = lookup "DOCKER_CERT_PATH" env
bamboo = lookup "bamboo_buildKey" env
jenkins = lookup "JENKINS_HOME" env
notBambooAndNotJenkins = isNothing bamboo && isNothing jenkins
msshAuthSock = lookup "SSH_AUTH_SOCK" env
muserEnv = lookup "USER" env
isRemoteDocker = maybe False (isPrefixOf "tcp://") dockerHost
Expand Down Expand Up @@ -245,11 +242,7 @@ runContainerAndExit = do
sandboxHomeDir = sandboxDir </> homeDirName
isTerm = isStdinTerminal && isStdoutTerminal && isStderrTerminal
allocatePseudoTty = not docker.detach && isTerm
keepStdinOpen = not docker.detach &&
-- Workaround for https://github.com/docker/docker/issues/12319
-- This is fixed in Docker 1.9.1, but will leave the workaround
-- in place for now, for users who haven't upgraded yet.
(isTerm || notBambooAndNotJenkins)
keepStdinOpen = not docker.detach
let mpath = T.pack <$> lookupImageEnv "PATH" imageEnvVars
when (isNothing mpath) $ do
prettyWarnL
Expand Down