You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cabal-install: Be less eager to configure external programs
In configureCompiler the call to configureAllKnownPrograms was too
eager. When called it selected the version of tools from PATH (such as
alex), and then when a package was configured these tools were passed
using `--with-alex` options to configure, which meant that the
build-tool-depends versions were not used. (See haskell#10692)
Why was this call introduced in the first place? Because
configureCompiler would a different result depending on whether:
* It is run for the first time, the `ProgramDb` will contain
unconfigured programs.
* It is run subsequently, `ProgramDb` is read from disk, it does not
contain unconfigured programs.
A surgical way to fix this is to avoid configuring the programs, and
manually adding back the builtinPrograms to the ProgramDb, so the
ProgramDb returned by configureCompiler always contains all the
unconfigured programs.
The testcase is not so easy to write because
* The bug only surfaces when the build-tool you are depending on is
known (ie alex, happy etc)
* But then it is tricky to write a test, as we can't depend on the known
tools or bundle the source for them.
* So we create a fake "alex", which cabal then invokes on a fake ".x"
file. This is maybe a bit fragile if the way cabal invokes alex
changes in future, but then the test can be modified as well.
Also see haskell#2241 and haskell#9840Fixeshaskell#10692
0 commit comments