cabal icon indicating copy to clipboard operation
cabal copied to clipboard

Be more careful in handling unconfigured programs in the program database

Open sheaf opened this issue 1 year ago • 1 comments

This PR contains several commits that address problems with how we were handling unconfigured programs in the program database:

  • We should configure unconfigured programs before serialising them (using the Binary ProgramDb instance) in Distribution.Client.ProjectPlanning.configureCompiler, as otherwise we can accidentally discard information. Not doing so can lead to situations in which we can build a package just fine, but if we re-start a build we will fail, because the program database on disk stored after configuring doesn't match the program database in memory.
  • As a follow-on from the above, configureRequiredProgram needs to gracefully handle an already-configured program. Not doing so means we would fall back to the simpleProgram treatment, which can cause Cabal to fail to configure a program such as hsc2hs which has custom logic for parsing its version number.
  • When compiling a Setup executable, we would pass a program database for use of the stripExe command. However, the strip program might not be configured in this program database; so we make sure to configure it (in the correct environment).

Template Α: This PR modifies behaviour or interface.

TODO:

  • [x] Patches conform to the coding conventions.
  • [x] Any changes that could be relevant to users have been recorded in the changelog.
  • [x] The documentation has been updated.
  • [x] Tests have been added.

sheaf avatar May 03 '24 12:05 sheaf

I've been trying to construct a test for these hard to trigger bugs, but I was unable to. I think it would be reasonable to move forward with this even if there are no tests given the difficulty in defining a test case for these properties.

alt-romes avatar May 08 '24 07:05 alt-romes

I recall this was quite a good patch. Could anyone please review? @andreabedini @Mikolaj

alt-romes avatar Jun 13 '24 07:06 alt-romes

@mergify backport 3.12

geekosaur avatar Sep 14 '24 00:09 geekosaur

backport 3.12

✅ Backports have been created

mergify[bot] avatar Sep 14 '24 00:09 mergify[bot]