haskell / haskell/cabal

Output marking is not thread-safe

Open
#4,376 3 comments 0 reactions 0 assignees View on GitHub
Cabal: tests/package-tests type: bug type: testing
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

I have observed under some conditions, Cabal will interleave stderr and stdout:

```
-----BEGIN CABAL OUTPUT-----
Downloading old-time-1.1.0.3...
[-Extracting /srv/code/haskell-pushbot/cabal-binaries/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.dist/home/.cabal/packages/test-local-repo/old-locale/1.0.0.7/old-locale-1.0.0.7.tar.gz to /srv/code/haskell-pushbot/cabal-binaries/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.dist/work/./dist/tmp/src-28346...-]
-----END CABAL OUTPUT-----
[-Updating old-locale.cabal with the latest revision from the index.-]
writing /srv/code/haskell-pushbot/cabal-binaries/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.dist/home/.cabal/packages/test-local-repo/old-time/1.1.0.3/old-time-1.1.0.3.tar.gz
{+Extracting /srv/code/haskell-pushbot/cabal-binaries/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.dist/home/.cabal/packages/test-local-repo/old-locale/1.0.0.7/old-locale-1.0.0.7.tar.gz to /srv/code/haskell-pushbot/cabal-binaries/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.dist/work/./dist/tmp/src-28736...+}
{+Updating old-locale.cabal with the latest revision from the index.+}
creating dist
```

(in this case, the Downloading message is occurring in a separate thread onto stdout, while "Extracting..." is stderr). This is bad juju. Probably the correct way to fix this is to prefix the markers on every line so we never get confused, but then we have to make sure stderr doesn't get interleaved within a single line this way.

Related: #4357

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.