cabal
cabal copied to clipboard
Be more careful in handling unconfigured programs in the program database
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 ProgramDbinstance) inDistribution.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,
configureRequiredProgramneeds to gracefully handle an already-configured program. Not doing so means we would fall back to thesimpleProgramtreatment, which can causeCabalto fail to configure a program such ashsc2hswhich has custom logic for parsing its version number. - When compiling a
Setupexecutable, we would pass a program database for use of thestripExecommand. However, thestripprogram 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.
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.
I recall this was quite a good patch. Could anyone please review? @andreabedini @Mikolaj
@mergify backport 3.12
backport 3.12
✅ Backports have been created
-
#10349 Be more careful in handling unconfigured programs in the program database (backport #9967) has been created for branch
3.12but encountered conflicts