Hello all,
I have recently been made aware that the file produced by cabal freeze
is not a true lock file.
A lock file is a file containing an exhaustive set of pinned dependency versions (and even sometimes with the hash of the source). The key property here is that a lock file is exhaustive: it contains the pinned version of every direct and indirect dependency.
You might want to use a lock file in situations where every direct and indirect dependency must be audited, and bringing in new dependencies (directly or indirectly) should only be done deliberately.
The cabal freeze
command can be used to create a file which looks very much like a lock file, with one caveat: the pinned dependency versions are not exhaustive.
Consider this example: a simple cabal project with a single cabal file, that looks like:
executable myexe:
build-depends: base, text
If I run cabal freeze
, the freeze file might look like this:
constraints: any.base ==4.20.0.0,
any.text ==2.1.1
If I edit my cabal file to this:
executable myexe:
build-depends: base, text, containers >=0.6
cabal-install
will happily build my package, even though containers
was not part of the freeze file. [1].
My question for the community is twofold:
- Did you know about this, or did you assume (like me) that such a situation would result in a build error?
- Is there a situation where it is desirable for the
cabal freeze
output to be non-exhaustive, or should we work towards plugging this hole?