Skip to content

Commit

Permalink
Don't use readDerivation() in addValidPath()
Browse files Browse the repository at this point in the history
readDerivation() requires a valid path.

Fixes NixOS#4210.
  • Loading branch information
edolstra committed Nov 2, 2020
1 parent 8b15650 commit 7cf874c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/libstore/local-store.cc
Expand Up @@ -623,7 +623,10 @@ uint64_t LocalStore::addValidPath(State & state,
efficiently query whether a path is an output of some
derivation. */
if (info.path.isDerivation()) {
auto drv = readDerivation(info.path);
auto drv = parseDerivation(
*this,
readFile(Store::toRealPath(info.path)),
Derivation::nameFromPath(info.path));

/* Verify that the output paths in the derivation are correct
(i.e., follow the scheme for computing output paths from
Expand Down Expand Up @@ -1000,7 +1003,11 @@ void LocalStore::registerValidPaths(const ValidPathInfos & infos)
for (auto & i : infos)
if (i.path.isDerivation()) {
// FIXME: inefficient; we already loaded the derivation in addValidPath().
checkDerivationOutputs(i.path, readDerivation(i.path));
checkDerivationOutputs(i.path,
parseDerivation(
*this,
readFile(Store::toRealPath(i.path)),
Derivation::nameFromPath(i.path)));
}

/* Do a topological sort of the paths. This will throw an
Expand Down

0 comments on commit 7cf874c

Please sign in to comment.