aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/realisation.cc
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2021-07-16 11:40:56 +0200
committerregnat <rg@regnat.ovh>2021-07-16 11:48:41 +0200
commita4ec6cb1da63941c9ec3e7ffcb7639fc21b858c8 (patch)
tree0234dca41fbb27cd0226b75fa9184e6158b22de8 /src/libstore/realisation.cc
parentdb4d4cf4ba42727edd8cc5a6c516554fb8a6b688 (diff)
Be more lenient when realisations have a conflicting dependency set
- This can legitimately happen (for example because of a non-determinism causing a build-time dependency to be kept or not as a runtime reference) - Because of older Nix versions, it can happen that we encounter a realisation with an (erroneously) empty set of dependencies, in which case we don’t want to fail, but just warn the user and try to fix it.
Diffstat (limited to 'src/libstore/realisation.cc')
-rw-r--r--src/libstore/realisation.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libstore/realisation.cc b/src/libstore/realisation.cc
index eadec594c..f871e6437 100644
--- a/src/libstore/realisation.cc
+++ b/src/libstore/realisation.cc
@@ -144,8 +144,16 @@ bool Realisation::isCompatibleWith(const Realisation & other) const
{
assert (id == other.id);
if (outPath == other.outPath) {
- assert(dependentRealisations == other.dependentRealisations);
- return true;
+ if (dependentRealisations.empty() != other.dependentRealisations.empty()) {
+ warn(
+ "Encountered a realisation for '%s' with an empty set of "
+ "dependencies. This is likely an artifact from an older Nix. "
+ "I’ll try to fix the realisation if I can",
+ id.to_string());
+ return true;
+ } else if (dependentRealisations == other.dependentRealisations) {
+ return true;
+ }
}
return false;
}