daemon: Filter build-chroot-dirs entries that conflict with derivation outputs.

Fixes https://github.com/NixOS/nixpkgs/issues/9504.

Note that this means we may have a non-functional /bin/sh in the
chroot while rebuilding Bash or one of its dependencies. Ideally those
packages don't rely on /bin/sh though.
This commit is contained in:
Eelco Dolstra 2015-09-02 14:54:12 +02:00 committed by Ludovic Courtès
parent 538684d0c4
commit 60c7c364f8

@ -1870,13 +1870,13 @@ void DerivationGoal::startBuilder()
}
}
/* If we're repairing or checking, it's possible that we're
/* If we're repairing, checking or rebuilding part of a
multiple-outputs derivation, it's possible that we're
rebuilding a path that is in settings.dirsInChroot
(typically the dependencies of /bin/sh). Throw them
out. */
if (buildMode != bmNormal)
foreach (DerivationOutputs::iterator, i, drv.outputs)
dirsInChroot.erase(i->second.path);
for (auto & i : drv.outputs)
dirsInChroot.erase(i.second.path);
#else
throw Error("chroot builds are not supported on this platform");