From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GKC5KcF2N2HfaAEAgWs5BA (envelope-from ) for ; Tue, 07 Sep 2021 16:27:13 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id EIpKJcF2N2EMJQAAB5/wlQ (envelope-from ) for ; Tue, 07 Sep 2021 14:27:13 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 72ED9BF1A for ; Tue, 7 Sep 2021 16:27:13 +0200 (CEST) Received: from localhost ([::1]:58270 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mNc48-0002Kf-I4 for larch@yhetil.org; Tue, 07 Sep 2021 10:27:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60334) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mNc3y-0002KP-LJ for bug-guix@gnu.org; Tue, 07 Sep 2021 10:27:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45709) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mNc3y-00083e-E0 for bug-guix@gnu.org; Tue, 07 Sep 2021 10:27:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mNc3y-0005Bg-4D for bug-guix@gnu.org; Tue, 07 Sep 2021 10:27:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#50441: Wrong build directory number shown in environment-variables file Resent-From: Christine Lemmer-Webber Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 07 Sep 2021 14:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50441 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Sarah Morgensen Received: via spool by 50441-submit@debbugs.gnu.org id=B50441.163102480619921 (code B ref 50441); Tue, 07 Sep 2021 14:27:02 +0000 Received: (at 50441) by debbugs.gnu.org; 7 Sep 2021 14:26:46 +0000 Received: from localhost ([127.0.0.1]:57255 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNc3h-0005BF-U7 for submit@debbugs.gnu.org; Tue, 07 Sep 2021 10:26:46 -0400 Received: from dustycloud.org ([50.116.34.160]:57684) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mNc3g-0005B6-At for 50441@debbugs.gnu.org; Tue, 07 Sep 2021 10:26:45 -0400 Received: from twig (localhost [127.0.0.1]) by dustycloud.org (Postfix) with ESMTPS id 92B1D2661E; Tue, 7 Sep 2021 10:26:43 -0400 (EDT) References: <87a6kpcs85.fsf@dustycloud.org> <86eea1hu44.fsf@mgsn.dev> User-agent: mu4e 1.6.2; emacs 27.2 From: Christine Lemmer-Webber Date: Tue, 07 Sep 2021 10:25:59 -0400 In-reply-to: <86eea1hu44.fsf@mgsn.dev> Message-ID: <877dfscvh8.fsf@dustycloud.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 50441@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -4.00 Authentication-Results: aspmx1.migadu.com; none X-Migadu-Queue-Id: 72ED9BF1A X-Spam-Score: -4.00 X-Migadu-Scanner: scn0.migadu.com X-TUID: N7Z997i9d3FG Loops like Tobias gave the explanation in their reply: > Part of the build environment isolation/reproducibility is that > processes inside it always see a build directory ending in =E2=80=98-0=E2= =80=99,=20 > regardless of the file name on the host system. Sarah Morgensen writes: > Hello Christine, > > Christine Lemmer-Webber writes: > >> I was doing guix build with "--keep-missing" and looking around in a few >> of the output directories. I was peeking in: >> >> /tmp/guix-build-u-boot-mnt-reform2-2021.06.drv-4 >> >> But wait... the "environment-variables" file says: >> >> #+BEGIN_SRC sh >> export TEMP=3D\ >> "/tmp/guix-build-u-boot-mnt-reform2-2021.06.drv-0" >> export TEMPDIR=3D\ >> "/tmp/guix-build-u-boot-mnt-reform2-2021.06.drv-0" >> export TMP=3D\ >> "/tmp/guix-build-u-boot-mnt-reform2-2021.06.drv-0" >> export TMPDIR=3D\ >> "/tmp/guix-build-u-boot-mnt-reform2-2021.06.drv-0" >> #+END_SRC >> >> Now wait a minute. Look at that last number. What the hell is going on >> here? Is this a bug in Guix? Why is it pointing at -0 in the -4 build >> directory? >> >> Does this point at a more serious issue? What's going on? > > I've definitely noticed this before as well, and had to work around it > (I needed to inspect temp caches). Thanks for actually sending a bug > report :) > > I'm not at all familiar with the nix code, but it looks like this might > be related: > > nix/libstore/build.cc:1654 > > /* In a sandbox, for determinism, always use the same temporary > directory. */ > tmpDirInSandbox =3D useChroot ? canonPath("/tmp", true) + "/guix-buil= d-" + drvName + "-0" : tmpDir; > > /* For convenience, set an environment pointing to the top build > directory. */ > env["NIX_BUILD_TOP"] =3D tmpDirInSandbox; > > /* Also set TMPDIR and variants to point to this directory. */ > env["TMPDIR"] =3D env["TEMPDIR"] =3D env["TMP"] =3D env["TEMP"] =3D t= mpDirInSandbox; > > /* Explicitly set PWD to prevent problems with chroot builds. In > particular, dietlibc cannot figure out the cwd because the > inode of the current directory doesn't appear in .. (because > getdents returns the inode of the mount point). */ > env["PWD"] =3D tmpDirInSandbox; > > I'm not entirely sure what's going on. I think we build in chroot by > default, which would explain why the temp vars get set to "-0" even > though everything else seems to work okay.