haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.61k stars 691 forks source link

ghc-pkg file conflicts #9431

Open chreekat opened 10 months ago

chreekat commented 10 months ago

Describe the bug I was running cabal on the same project in parallel:

  1. One instance was building with --builddir=dist-newstyle [edit: incorrect, see followup comment]
  2. One instance was building with --builddir=dist-pure (with different flags)
  3. HLS was also running
cabal --builddir=dist-pure -fpure-haskell -j4 build --enable-tests --enable-benchmarks
Build profile: -w ghc-9.2.8 -O1
In order, the following will be built (use -v for more details):
 - text-2.1 (test:tests) (additional components to build)
Preprocessing test suite 'tests' for text-2.1..
Building test suite 'tests' for text-2.1..
cabal --builddir=dist-pure -fpure-haskell -j4 test --test-options=''
Build profile: -w ghc-9.2.8 -O1
In order, the following will be built (use -v for more details):
 - text-2.1 (test:tests) (ephemeral targets)
ghc-pkg: cannot create: /home/b/Projects/usort/usort-web/text-clone/dist-pure/build/x86_64-linux/ghc-9.2.8/text-2.1/t/tests/package.conf.inplace already exists
make: *** [Makefile:36: pure.test] Error 1

I don't know how easy this will be to reproduce, but note that something similar happens often enough on GHC to cause pain. Lots of examples here: https://grafana.gitlab.haskell.org/d/167r9v6nk/ci-spurious-failures?orgId=2&var-types=ghc-pkg_died&var-jobs=All&var-runners=All&from=now-45d&to=now&refresh=15m

To Reproduce :shrug:

Expected behavior Don't make ghc-pkg angry

System information

cabal-install version 3.10.1.0 compiled using version 3.10.1.0 of the Cabal library

The Glorious Glasgow Haskell Compilation System, version 9.2.8

chreekat commented 10 months ago

Oh. I had a typo in my entr script. I actually did have two instances of cabal compiling in the same builddir at the same time. Perhaps this is a known issue.

geekosaur commented 10 months ago

Yes, that's known not to work although it's not well communicated in the documentation and we really should lock dist directories while they're in use.