diff -crB guix-master/nix/libstore/build.cc guix-userspace/nix/libstore/build.cc *** guix-master/nix/libstore/build.cc Wed May 4 09:56:21 2016 --- guix-userspace/nix/libstore/build.cc Mon Apr 25 16:39:29 2016 *************** *** 1811,1818 **** buildUser.kill(); /* Change ownership of the temporary build directory. */ ! if (chown(tmpDir.c_str(), buildUser.getUID(), buildUser.getGID()) == -1) ! throw SysError(format("cannot change ownership of '%1%'") % tmpDir); } if (useChroot) { --- 1811,1818 ---- buildUser.kill(); /* Change ownership of the temporary build directory. */ ! //if (chown(tmpDir.c_str(), buildUser.getUID(), buildUser.getGID()) == -1) ! // throw SysError(format("cannot change ownership of '%1%'") % tmpDir); } if (useChroot) { *************** *** 1832,1839 **** if (mkdir(chrootRootDir.c_str(), 0750) == -1) throw SysError(format("cannot create ‘%1%’") % chrootRootDir); ! if (chown(chrootRootDir.c_str(), 0, buildUser.getGID()) == -1) ! throw SysError(format("cannot change ownership of ‘%1%’") % chrootRootDir); /* Create a writable /tmp in the chroot. Many builders need this. (Of course they should really respect $TMPDIR --- 1832,1839 ---- if (mkdir(chrootRootDir.c_str(), 0750) == -1) throw SysError(format("cannot create ‘%1%’") % chrootRootDir); ! //if (chown(chrootRootDir.c_str(), 0, buildUser.getGID()) == -1) ! // throw SysError(format("cannot change ownership of ‘%1%’") % chrootRootDir); /* Create a writable /tmp in the chroot. Many builders need this. (Of course they should really respect $TMPDIR *************** *** 1889,1896 **** createDirs(chrootStoreDir); chmod_(chrootStoreDir, 01775); ! if (chown(chrootStoreDir.c_str(), 0, buildUser.getGID()) == -1) ! throw SysError(format("cannot change ownership of ‘%1%’") % chrootStoreDir); foreach (PathSet::iterator, i, inputPaths) { struct stat st; --- 1889,1896 ---- createDirs(chrootStoreDir); chmod_(chrootStoreDir, 01775); ! //if (chown(chrootStoreDir.c_str(), 0, buildUser.getGID()) == -1) ! // throw SysError(format("cannot change ownership of ‘%1%’") % chrootStoreDir); foreach (PathSet::iterator, i, inputPaths) { struct stat st; *************** *** 1999,2010 **** --- 1999,2014 ---- */ #if CHROOT_ENABLED if (useChroot) { + pid = fork(); + if (pid == 0) runChild(); + /* char stack[32 * 1024]; int flags = CLONE_NEWPID | CLONE_NEWNS | CLONE_NEWIPC | CLONE_NEWUTS | SIGCHLD; if (!fixedOutput) flags |= CLONE_NEWNET; pid = clone(childEntry, stack + sizeof(stack) - 8, flags, this); if (pid == -1) throw SysError("cloning builder process"); + */ } else #endif { *************** *** 2045,2051 **** commonChildInit(builderOut); ! #if CHROOT_ENABLED if (useChroot) { /* Initialise the loopback interface. */ AutoCloseFD fd(socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)); --- 2049,2055 ---- commonChildInit(builderOut); ! #if CHROOT_ENABLED && 0 if (useChroot) { /* Initialise the loopback interface. */ AutoCloseFD fd(socket(PF_INET, SOCK_DGRAM, IPPROTO_IP));