GNU bug report logs - #50441
Wrong build directory number shown in environment-variables file

Previous Next

Package: guix;

Reported by: Christine Lemmer-Webber <cwebber <at> dustycloud.org>

Date: Mon, 6 Sep 2021 21:25:02 UTC

Severity: normal

Full log


Message #17 received at 50441 <at> debbugs.gnu.org (full text, mbox):

From: Christine Lemmer-Webber <cwebber <at> dustycloud.org>
To: Sarah Morgensen <iskarian <at> mgsn.dev>
Cc: 50441 <at> debbugs.gnu.org
Subject: Re: bug#50441: Wrong build directory number shown in
 environment-variables file
Date: Tue, 07 Sep 2021 10:25:59 -0400
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 ‘-0’, 
> regardless of the file name on the host system.

Sarah Morgensen <iskarian <at> mgsn.dev> writes:

> Hello Christine,
>
> Christine Lemmer-Webber <cwebber <at> dustycloud.org> 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=\
>> "/tmp/guix-build-u-boot-mnt-reform2-2021.06.drv-0"
>> export TEMPDIR=\
>> "/tmp/guix-build-u-boot-mnt-reform2-2021.06.drv-0"
>> export TMP=\
>> "/tmp/guix-build-u-boot-mnt-reform2-2021.06.drv-0"
>> export TMPDIR=\
>> "/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 = useChroot ? canonPath("/tmp", true) + "/guix-build-" + drvName + "-0" : tmpDir;
>
>     /* For convenience, set an environment pointing to the top build
>        directory. */
>     env["NIX_BUILD_TOP"] = tmpDirInSandbox;
>
>     /* Also set TMPDIR and variants to point to this directory. */
>     env["TMPDIR"] = env["TEMPDIR"] = env["TMP"] = env["TEMP"] = tmpDirInSandbox;
>
>     /* 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"] = 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.





This bug report was last modified 3 years and 273 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.