Skip to content

Commit cd6d1c6

Browse files
committed
cabal-install configureCompiler: configure progdb
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. This isn't currently a live bug, because in practice we end up re-running configuration steps when interfacing with the Cabal library. However, in the bright future in which we avoid re-configuring things when building a Cabal package that we already determined when invoking cabal-install, this starts causing problems.
1 parent 27784f6 commit cd6d1c6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cabal-install/src/Distribution/Client/ProjectPlanning.hs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,24 +482,28 @@ configureCompiler
482482
liftIO $ info verbosity "Compiler settings changed, reconfiguring..."
483483
progdb <- liftIO $ prependProgramSearchPath verbosity (fromNubList packageConfigProgramPathExtra) defaultProgramDb
484484
let progdb' = userSpecifyPaths (Map.toList (getMapLast packageConfigProgramPaths)) progdb
485-
result@(_, _, progdb'') <-
485+
(comp, plat, progdb'') <-
486486
liftIO $
487487
Cabal.configCompilerEx
488488
hcFlavor
489489
hcPath
490490
hcPkg
491491
progdb'
492492
verbosity
493+
-- Configure the unconfigured programs in the program database,
494+
-- as we can't serialise unconfigured programs.
495+
-- See also #2241 and #9840.
496+
finalProgDb <- liftIO $ configureAllKnownPrograms verbosity progdb''
493497

494498
-- Note that we added the user-supplied program locations and args
495499
-- for /all/ programs, not just those for the compiler prog and
496500
-- compiler-related utils. In principle we don't know which programs
497501
-- the compiler will configure (and it does vary between compilers).
498502
-- We do know however that the compiler will only configure the
499503
-- programs it cares about, and those are the ones we monitor here.
500-
monitorFiles (programsMonitorFiles progdb'')
504+
monitorFiles (programsMonitorFiles finalProgDb)
501505

502-
return result
506+
return (comp, plat, finalProgDb)
503507
where
504508
hcFlavor = flagToMaybe projectConfigHcFlavor
505509
hcPath = flagToMaybe projectConfigHcPath

0 commit comments

Comments
 (0)