Several build --keep-failed result in wrong env variables

  • Done
  • quality assurance status badge
Details
3 participants
  • Dmitry Matveyev
  • Leo Famulari
  • Mark H Weaver
Owner
unassigned
Submitted by
Dmitry Matveyev
Severity
normal
D
D
Dmitry Matveyev wrote on 15 Apr 2021 04:31
(address . bug-guix@gnu.org)
87r1jc5ld1.fsf@yandex.com
Hello,

I use guix on Arch Linux, version
050be36cbf3a42199f64f2e44c59f1cb1b3afab5.

Several invocations of guix build --keep-failed creates directories in
/tmp like this one guix-build-hello-2.10.drv-0 for 1st build and then
guix-build-hello-2.10.drv-1 for 2nd and so on (with last digit
increasing). But environment variables for all of them are set to point
to the very 1st directory.

Reproduce:

$ guix build --check --keep-failed hello
^C
$ guix build --check --keep-failed hello
^C
$ cd /tmp/guix-build-hello-2.10.drv-1/
$ grep PWD environment-variables
export OLDPWD
export PWD="/tmp/guix-build-hello-2.10.drv-0/hello-2.10"

Here although we are in directory /tmp/guix-build-hello-2.10.drv-1/, PWD
is set to .drv-0 directory.

Regards,
Dmitry.
L
L
Leo Famulari wrote on 15 Apr 2021 19:06
(name . Dmitry Matveyev)(address . greenfork.lists@yandex.com)(address . 47786@debbugs.gnu.org)
YHhyp4v/7g7Gfujo@jasmine.lan
On Thu, Apr 15, 2021 at 08:31:54AM +0600, Dmitry Matveyev wrote:
Toggle quote (25 lines)
> Hello,
>
> I use guix on Arch Linux, version
> 050be36cbf3a42199f64f2e44c59f1cb1b3afab5.
>
> Several invocations of guix build --keep-failed creates directories in
> /tmp like this one guix-build-hello-2.10.drv-0 for 1st build and then
> guix-build-hello-2.10.drv-1 for 2nd and so on (with last digit
> increasing). But environment variables for all of them are set to point
> to the very 1st directory.
>
> Reproduce:
>
> $ guix build --check --keep-failed hello
> ^C
> $ guix build --check --keep-failed hello
> ^C
> $ cd /tmp/guix-build-hello-2.10.drv-1/
> $ grep PWD environment-variables
> export OLDPWD
> export PWD="/tmp/guix-build-hello-2.10.drv-0/hello-2.10"
>
> Here although we are in directory /tmp/guix-build-hello-2.10.drv-1/, PWD
> is set to .drv-0 directory.

I see, thanks for the report.

This is probably because, within the build environment, the directory is
always named '/tmp/guix-build-$name-$version.drv-0/', for
reproducibility.

We should see about changing the PWD variable after the build fails.
M
M
Mark H Weaver wrote on 15 Apr 2021 22:24
875z0ni9cy.fsf@netris.org
tags 47786 + notabug
close 47786
thanks

Hi Dmitry,

Dmitry Matveyev <greenfork.lists@yandex.com> writes:

Toggle quote (9 lines)
> I use guix on Arch Linux, version
> 050be36cbf3a42199f64f2e44c59f1cb1b3afab5.
>
> Several invocations of guix build --keep-failed creates directories in
> /tmp like this one guix-build-hello-2.10.drv-0 for 1st build and then
> guix-build-hello-2.10.drv-1 for 2nd and so on (with last digit
> increasing). But environment variables for all of them are set to point
> to the very 1st directory.

This is the intended behavior, although I agree that it can be
surprising.

The environment variables refer to "/tmp/guix-build-….drv-0" because
within the build container, the directory is _always_ named
"/tmp/guix-build-….drv-0", regardless of what name was given to the
directory outside of the build container.

In general, where practical, we try to isolate the build container from
irrelevant details about the host system (such as the contents of /tmp),
because those details might leak into the build outputs, compromising
reproducibility.

For example, some packages retain the absolute file name of the build
directory, as an aid to developers when users report bugs.
Reproducibility of such package builds would be lost if the build
directory name varied depending on the contents on /tmp on the host
system.

Does that make sense?

Thanks for the report,

Mark
D
D
Dmitry Matveyev wrote on 16 Apr 2021 06:49
(name . Mark H Weaver)(address . mhw@netris.org)(address . 47786@debbugs.gnu.org)
87a6py7s16.fsf@yandex.com
Hi Mark,

Mark H Weaver <mhw@netris.org> writes:

Toggle quote (3 lines)
> This is the intended behavior, although I agree that it can be
> surprising.

Thank you for explaining, I think it's clear now!

Regards,
Dmitry.
?
Your comment

This issue is archived.

To comment on this conversation send an email to 47786@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 47786
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch