Skip to content

Commit 4cbcaad

Browse files
committed
libstore/registerOutputs: Don't try to optimize a non-existent actualPath
Since 3c610df this resulted in `getting status of` errors on paths inside the chroot if a path was already valid. Careful inspection of the logic shows that if buildMode != bmCheck actualPath gets reassigned to store.toRealPath(finalDestPath). The only branch that cares about actualPath is the buildMode == bmCheck case, which doesn't lead to optimisePath anyway.
1 parent f84b336 commit 4cbcaad

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libstore/unix/build/derivation-builder.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,6 @@ SingleDrvOutputs DerivationBuilderImpl::registerOutputs()
17421742
if (buildMode == bmRepair) {
17431743
/* Path already exists, need to replace it */
17441744
replaceValidPath(store.toRealPath(finalDestPath), actualPath);
1745-
actualPath = store.toRealPath(finalDestPath);
17461745
} else if (buildMode == bmCheck) {
17471746
/* Path already exists, and we want to compare, so we leave out
17481747
new path in place. */
@@ -1756,7 +1755,6 @@ SingleDrvOutputs DerivationBuilderImpl::registerOutputs()
17561755
auto destPath = store.toRealPath(finalDestPath);
17571756
deletePath(destPath);
17581757
movePath(actualPath, destPath);
1759-
actualPath = destPath;
17601758
}
17611759
}
17621760

@@ -1809,7 +1807,9 @@ SingleDrvOutputs DerivationBuilderImpl::registerOutputs()
18091807
debug("unreferenced input: '%1%'", store.printStorePath(i));
18101808
}
18111809

1812-
store.optimisePath(actualPath, NoRepair); // FIXME: combine with scanForReferences()
1810+
if (!store.isValidPath(newInfo.path))
1811+
store.optimisePath(
1812+
store.toRealPath(finalDestPath), NoRepair); // FIXME: combine with scanForReferences()
18131813

18141814
newInfo.deriver = drvPath;
18151815
newInfo.ultimate = true;

0 commit comments

Comments
 (0)