From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#25242: Cannot build source derivations with a custom TMPDIR Date: Thu, 29 Dec 2016 18:23:45 +0100 Message-ID: <87k2aihcny.fsf@gnu.org> References: <20161221082240.GA30326@jasmine> <20161221085421.GA32042@jasmine> <87r351myej.fsf@gnu.org> <20161223001118.GA15208@jasmine> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cMeQt-0002bp-KX for bug-guix@gnu.org; Thu, 29 Dec 2016 12:24:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cMeQs-0007z4-L3 for bug-guix@gnu.org; Thu, 29 Dec 2016 12:24:03 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:43929) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cMeQs-0007yu-IR for bug-guix@gnu.org; Thu, 29 Dec 2016 12:24:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cMeQs-0007lC-CM for bug-guix@gnu.org; Thu, 29 Dec 2016 12:24:02 -0500 Sender: "Debbugs-submit" Resent-To: bug-guix@gnu.org Resent-Message-ID: In-Reply-To: <20161223001118.GA15208@jasmine> (Leo Famulari's message of "Thu, 22 Dec 2016 19:11:18 -0500") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Leo Famulari Cc: 25242-done@debbugs.gnu.org Leo Famulari skribis: > On Wed, Dec 21, 2016 at 10:20:20AM +0100, Ludovic Court=C3=A8s wrote: >> AFAICS the flaw is that there=E2=80=99s one place where I wrote: >>=20 >> if (useChroot && !isBuiltin(drv)) >>=20 >> while several other places just do something like: >>=20 >> if (useChroot) >>=20 >> Could the patch below solve the problem? >>=20 > >> diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc >> index e823001..38048ce 100644 >> --- a/nix/libstore/build.cc >> +++ b/nix/libstore/build.cc >> @@ -1680,7 +1680,11 @@ void DerivationGoal::startBuilder() >> % drv.platform % settings.thisSystem % drvPath); >> } >>=20=20 >> - useChroot =3D settings.useChroot; >> + /* Note: built-in builders are *not* running in a chroot environmen= t so >> + that we can easily implement them in Guile without having it as a >> + derivation input (they are running under a separate build user, >> + though). */ >> + useChroot =3D settings.useChroot && !isBuiltin(drv); >>=20=20 >> /* Construct the environment passed to the builder. */ >> env.clear(); >> @@ -2048,12 +2052,7 @@ void DerivationGoal::runChild() >> commonChildInit(builderOut); >>=20=20 >> #if CHROOT_ENABLED >> - /* Note: built-in builders are *not* running in a chroot environment >> - so that we can easily implement them in Guile without having it as >> - a derivation input (they are running under a separate build user, >> - though). */ >> - >> - if (useChroot && !isBuiltin(drv)) { >> + if (useChroot) { >> /* Initialise the loopback interface. */ >> AutoCloseFD fd(socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)); >> if (fd =3D=3D -1) throw SysError("cannot open IP socket"); > > Yes, this does fix the problem! Awesome! > I wonder if I should commit this while Ludo is away? You could have done it. :-) I=E2=80=99ve just pushed it as 8ecc3c6c447765b1f7c15b980f985d1826f48659. Thank you! Ludo=E2=80=99.