about summary refs log tree commit diff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-05-03T09·02+0200
committerEelco Dolstra <edolstra@gmail.com>2018-05-03T09·02+0200
commit80a7b16593951791c4a85053a7cc14fc45260cee (patch)
tree7da339b0d815de63c241ce8b2e79e51ce6e612de /src/libstore
parent53ec5ac69f59ac435b18297a594933e83e236766 (diff)
LocalStore::addValidPath(): Throw error when the CA assertion is wrong
Closes #2133.
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/local-store.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index b63584f28a30..ef8c2811bd86 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -581,7 +581,8 @@ void LocalStore::checkDerivationOutputs(const Path & drvPath, const Derivation &
 uint64_t LocalStore::addValidPath(State & state,
     const ValidPathInfo & info, bool checkOutputs)
 {
-    assert(info.ca == "" || info.isContentAddressed(*this));
+    if (info.ca != "" && !info.isContentAddressed(*this))
+        throw Error("cannot add path '%s' to the Nix store because it claims to be content-addressed but isn't", info.path);
 
     state.stmtRegisterValidPath.use()
         (info.path)