diff options
author | Taeer Bar-Yam <taeer.bar-yam@tweag.io> | 2022-12-05 23:21:58 -0500 |
---|---|---|
committer | Taeer Bar-Yam <taeer.bar-yam@tweag.io> | 2022-12-05 23:22:38 -0500 |
commit | 8c7661da0963a6a578605374cd9b309177563b3d (patch) | |
tree | 234a61b3883066410d5ca3c4036b0a1da4bdd940 | |
parent | bfcf30f0abdfd1df4364919f203d04ff08d7314c (diff) |
check the store for input before failing (hopefully fix #6383)
-rw-r--r-- | src/libstore/build/derivation-goal.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc index 5aed51bcd..7dd39051b 100644 --- a/src/libstore/build/derivation-goal.cc +++ b/src/libstore/build/derivation-goal.cc @@ -1016,11 +1016,20 @@ void DerivationGoal::resolvedFinished() throw Error( "derivation '%s' doesn't have expected output '%s' (derivation-goal.cc/resolvedFinished,resolve)", worker.store.printStorePath(drvPath), wantedOutput); - auto realisation = get(resolvedResult.builtOutputs, DrvOutput { *resolvedHash, wantedOutput }); - if (!realisation) + + const Realisation * realisation = get(resolvedResult.builtOutputs, DrvOutput { *resolvedHash, wantedOutput }); + if (!realisation) { + /* The above `get` should work. But sateful tracking of + outputs in resolvedResult, this can get out of sync with the + store, which is our actual source of truth. For now we just + check the store directly if it fails. */ + realisation = worker.evalStore.queryRealisation(DrvOutput { *resolvedHash, wantedOutput }).get(); + if (!realisation) { throw Error( "derivation '%s' doesn't have expected output '%s' (derivation-goal.cc/resolvedFinished,realisation)", worker.store.printStorePath(resolvedDrvGoal->drvPath), wantedOutput); + } + } if (drv->type().isPure()) { auto newRealisation = *realisation; newRealisation.id = DrvOutput { initialOutput->outputHash, wantedOutput }; |