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

DoneSubmitted by Dmitry Matveyev.
Details
3 participants
  • Dmitry Matveyev
  • Leo Famulari
  • Mark H Weaver
Owner
unassigned
Severity
normal
D
D
Dmitry Matveyev wrote on 15 Apr 04:31 +0200
(address . bug-guix@gnu.org)
87r1jc5ld1.fsf@yandex.com
Hello,
I use guix on Arch Linux, version050be36cbf3a42199f64f2e44c59f1cb1b3afab5.
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 thenguix-build-hello-2.10.drv-1 for 2nd and so on (with last digitincreasing). But environment variables for all of them are set to pointto 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-variablesexport OLDPWDexport 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/, PWDis set to .drv-0 directory.
Regards,Dmitry.
L
L
Leo Famulari wrote on 15 Apr 19:06 +0200
(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 isalways named '/tmp/guix-build-$name-$version.drv-0/', forreproducibility.
We should see about changing the PWD variable after the build fails.
M
M
Mark H Weaver wrote on 15 Apr 22:24 +0200
875z0ni9cy.fsf@netris.org
tags 47786 + notabugclose 47786thanks
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 besurprising.
The environment variables refer to "/tmp/guix-build-….drv-0" becausewithin the build container, the directory is _always_ named"/tmp/guix-build-….drv-0", regardless of what name was given to thedirectory outside of the build container.
In general, where practical, we try to isolate the build container fromirrelevant details about the host system (such as the contents of /tmp),because those details might leak into the build outputs, compromisingreproducibility.
For example, some packages retain the absolute file name of the builddirectory, as an aid to developers when users report bugs.Reproducibility of such package builds would be lost if the builddirectory name varied depending on the contents on /tmp on the hostsystem.
Does that make sense?
Thanks for the report,
Mark
D
D
Dmitry Matveyev wrote on 16 Apr 06:49 +0200
(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.
?