mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-30 01:26:15 +02:00
* Use a PathSet for the chroot directories so that we don't
accidentally bind-mount a directory twice.
This commit is contained in:
parent
d86bd22d24
commit
6776a52bb3
1 changed files with 7 additions and 6 deletions
|
@ -1665,7 +1665,7 @@ void DerivationGoal::startBuilder()
|
||||||
work properly. Purity checking for fixed-output derivations
|
work properly. Purity checking for fixed-output derivations
|
||||||
is somewhat pointless anyway. */
|
is somewhat pointless anyway. */
|
||||||
useChroot = queryBoolSetting("build-use-chroot", false);
|
useChroot = queryBoolSetting("build-use-chroot", false);
|
||||||
Paths dirsInChroot;
|
PathSet dirsInChroot;
|
||||||
|
|
||||||
if (fixedOutput) useChroot = false;
|
if (fixedOutput) useChroot = false;
|
||||||
|
|
||||||
|
@ -1707,9 +1707,10 @@ void DerivationGoal::startBuilder()
|
||||||
defaultDirs.push_back("/dev/pts");
|
defaultDirs.push_back("/dev/pts");
|
||||||
defaultDirs.push_back("/proc");
|
defaultDirs.push_back("/proc");
|
||||||
|
|
||||||
dirsInChroot = querySetting("build-chroot-dirs", defaultDirs);
|
Paths dirsInChroot_ = querySetting("build-chroot-dirs", defaultDirs);
|
||||||
|
dirsInChroot.insert(dirsInChroot_.begin(), dirsInChroot_.end());
|
||||||
|
|
||||||
dirsInChroot.push_front(tmpDir);
|
dirsInChroot.insert(tmpDir);
|
||||||
|
|
||||||
/* Make the closure of the inputs available in the chroot,
|
/* Make the closure of the inputs available in the chroot,
|
||||||
rather than the whole Nix store. This prevents any access
|
rather than the whole Nix store. This prevents any access
|
||||||
|
@ -1726,7 +1727,7 @@ void DerivationGoal::startBuilder()
|
||||||
if (lstat(i->c_str(), &st))
|
if (lstat(i->c_str(), &st))
|
||||||
throw SysError(format("getting attributes of path `%1%'") % *i);
|
throw SysError(format("getting attributes of path `%1%'") % *i);
|
||||||
if (S_ISDIR(st.st_mode))
|
if (S_ISDIR(st.st_mode))
|
||||||
dirsInChroot.push_back(*i);
|
dirsInChroot.insert(*i);
|
||||||
else {
|
else {
|
||||||
Path p = chrootRootDir + *i;
|
Path p = chrootRootDir + *i;
|
||||||
if (link(i->c_str(), p.c_str()) == -1)
|
if (link(i->c_str(), p.c_str()) == -1)
|
||||||
|
@ -1776,7 +1777,7 @@ void DerivationGoal::startBuilder()
|
||||||
/* Bind-mount all the directories from the "host"
|
/* Bind-mount all the directories from the "host"
|
||||||
filesystem that we want in the chroot
|
filesystem that we want in the chroot
|
||||||
environment. */
|
environment. */
|
||||||
foreach (Paths::iterator, i, dirsInChroot) {
|
foreach (PathSet::iterator, i, dirsInChroot) {
|
||||||
Path source = *i;
|
Path source = *i;
|
||||||
Path target = chrootRootDir + source;
|
Path target = chrootRootDir + source;
|
||||||
debug(format("bind mounting `%1%' to `%2%'") % source % target);
|
debug(format("bind mounting `%1%' to `%2%'") % source % target);
|
||||||
|
|
Loading…
Reference in a new issue