From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: 'guix build' and garbage collection Date: Sun, 02 Apr 2017 11:30:41 +0200 Message-ID: <87inmnb1ha.fsf@gnu.org> References: <878tnjk489.fsf@gmail.com> 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]:36387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cubqS-0007DV-2J for guix-devel@gnu.org; Sun, 02 Apr 2017 05:30:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cubqO-0002uf-M4 for guix-devel@gnu.org; Sun, 02 Apr 2017 05:30:47 -0400 In-Reply-To: <878tnjk489.fsf@gmail.com> (Chris Marusich's message of "Sat, 01 Apr 2017 18:06:30 -0700") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Chris Marusich Cc: guix-devel@gnu.org Hi Chris, Chris Marusich skribis: > I saw this in guix/scripts.build.scm: > > (and (build-derivations store drv mode) > (for-each show-derivation-outputs drv) > (for-each (cut register-root store <> <>) > (map (lambda (drv) > (map cdr > (derivation->output-paths drv))) > drv) > roots)) > > Here, we build the derivations, and then we add indirect GC roots. My > question is: what guarantee is there that the output paths will not be > garbage collected after we build the derivations but before we add the > indirect GC roots? For the duration of the connection to the build daemon, build results are registered as GC roots, so we=E2=80=99re fine. You can see it in the =E2=80=98DerivationGoal=E2=80=99 constructor in libst= ore/build.cc: /* Prevent the .chroot directory from being garbage-collected. (See isActiveTempFile() in gc.cc.) */ worker.store.addTempRoot(drvPath); Likewise in =E2=80=98SubstitutionGoal::init=E2=80=99. HTH, Ludo=E2=80=99.