GNU bug report logs - #55270
unpack phase randomly changes the cwd

Previous Next

Package: guix;

Reported by: Attila Lendvai <attila <at> lendvai.name>

Date: Thu, 5 May 2022 11:17:01 UTC

Severity: normal

To reply to this bug, email your comments to 55270 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#55270; Package guix. (Thu, 05 May 2022 11:17:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Attila Lendvai <attila <at> lendvai.name>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Thu, 05 May 2022 11:17:01 GMT) Full text and rfc822 format available.

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

From: Attila Lendvai <attila <at> lendvai.name>
To: "bug-guix <at> gnu.org" <bug-guix <at> gnu.org>
Subject: unpack phase randomly changes the cwd
Date: Thu, 05 May 2022 11:16:29 +0000
at the end of the unpack phase, the working directory is changed to a random directory.

https://git.savannah.gnu.org/cgit/guix.git/tree/guix/build/gnu-build-system.scm#n178

this is fine *when* the archive contains a single dir... but this DWIM'ness has just burned 15 mintues of my life, and i recommend removing it.

if it is to stay, then at least it should be patched that it only happens when the dir after extraction only contains a single subdir, and no files otherwise.

--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“When men hire themselves out to shoot other men to order, asking nothing about the justice of their cause, I don’t care if they are shot themselves.”
	— Herbert Spencer (1820–1903), during Britain's second Afghan war





Information forwarded to bug-guix <at> gnu.org:
bug#55270; Package guix. (Thu, 05 May 2022 12:19:01 GMT) Full text and rfc822 format available.

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

From: Maxime Devos <maximedevos <at> telenet.be>
To: Attila Lendvai <attila <at> lendvai.name>, 55270 <at> debbugs.gnu.org
Subject: Re: bug#55270: unpack phase randomly changes the cwd
Date: Thu, 05 May 2022 14:18:21 +0200
[Message part 1 (text/plain, inline)]
Attila Lendvai schreef op do 05-05-2022 om 11:16 [+0000]:
> at the end of the unpack phase, the working directory is changed to a random directory.
> 
> https://git.savannah.gnu.org/cgit/guix.git/tree/guix/build/gnu-build-system.scm#n178

It takes the first result 'scandir' -- i.e., the 'smallest' file name
according to string-locale<?, so technically it's not random (so no
reproducibility problems)

> 
> this is fine *when* the archive contains a single dir... but this DWIM'ness has just burned 15 mintues of my life, and i recommend removing it.
> 
> if it is to stay, then at least it should be patched that it only happens when the dir after extraction only contains a single subdir, and no files otherwise.

Except maybe when using 'out-of-source?', I think it has to stay in
some form -- somehow, we will have to run build scripts, "make", maybe
do some 'substitute*', and having to type the version number and
directory name inside build phases seems a bit error-prone (what if the
source is changed fom tarball or 'zip' to a vcs checkout?).

I agree with only chdiring if there's only one subdir (and no other
files) though -- ‘just the first’ is a bit arbitrary.

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#55270; Package guix. (Thu, 05 May 2022 13:16:02 GMT) Full text and rfc822 format available.

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

From: Attila Lendvai <attila <at> lendvai.name>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 55270 <at> debbugs.gnu.org
Subject: Re: bug#55270: unpack phase randomly changes the cwd
Date: Thu, 05 May 2022 13:15:28 +0000
> It takes the first result 'scandir' -- i.e., the 'smallest' file name
> according to string-locale<?, so technically it's not random (so no
> reproducibility problems)


fair enough. what i meant to communicate is that it's arbitrary, not random.

another potential issue:

if the root of the archive contains a file called 'environment-variables', then this way it would overwrite the one generated by Guix. this may not necessarily be an issue, though, if that file is never used after the unpack phase.

maybe the cleanest would be to:

1) mkdir a directory ('extracted/'?) and chdir into it prior to
   unpacking, and

2) only do the DWIM chdir if the toplevel of the archive was a single
   dir.

but i lack the necessary perspective to see all the implications.

--
• attila lendvai
• PGP: 963F 5D5F 45C7 DFCD 0A39
--
“There is always a philosophy for lack of courage.”
	— Albert Camus (1913–1960)





Information forwarded to bug-guix <at> gnu.org:
bug#55270; Package guix. (Thu, 05 May 2022 20:13:02 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Attila Lendvai <attila <at> lendvai.name>, 55270 <at> debbugs.gnu.org
Subject: Re: unpack phase randomly changes the cwd
Date: Thu, 05 May 2022 22:12:12 +0200
Am Donnerstag, dem 05.05.2022 um 11:16 +0000 schrieb Attila Lendvai:
> at the end of the unpack phase, the working directory is changed to a
> random directory.
> 
> https://git.savannah.gnu.org/cgit/guix.git/tree/guix/build/gnu-build-system.scm#n178
> 
> this is fine *when* the archive contains a single dir... but this
> DWIM'ness has just burned 15 mintues of my life, and i recommend
> removing it.
url-fetch/tarbomb: Now this looks like a job for me.






Information forwarded to bug-guix <at> gnu.org:
bug#55270; Package guix. (Tue, 12 Jul 2022 14:12:01 GMT) Full text and rfc822 format available.

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

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: Attila Lendvai <attila <at> lendvai.name>, 55270 <at> debbugs.gnu.org
Subject: Re: bug#55270: unpack phase randomly changes the cwd
Date: Tue, 12 Jul 2022 10:11:46 -0400
Hi,

Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:

> Am Donnerstag, dem 05.05.2022 um 11:16 +0000 schrieb Attila Lendvai:
>> at the end of the unpack phase, the working directory is changed to a
>> random directory.
>> 
>> https://git.savannah.gnu.org/cgit/guix.git/tree/guix/build/gnu-build-system.scm#n178
>> 
>> this is fine *when* the archive contains a single dir... but this
>> DWIM'ness has just burned 15 mintues of my life, and i recommend
>> removing it.

> url-fetch/tarbomb: Now this looks like a job for me.

Just to make sure, are you suggesting the archive type used here would
have been better handled by url-fetch/tarboom?

Thanks,

Maxim




Information forwarded to bug-guix <at> gnu.org:
bug#55270; Package guix. (Tue, 12 Jul 2022 16:48:02 GMT) Full text and rfc822 format available.

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

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Cc: Attila Lendvai <attila <at> lendvai.name>, 55270 <at> debbugs.gnu.org
Subject: Re: bug#55270: unpack phase randomly changes the cwd
Date: Tue, 12 Jul 2022 18:47:42 +0200
Am Dienstag, dem 12.07.2022 um 10:11 -0400 schrieb Maxim Cournoyer:
> Hi,
> 
> Liliana Marie Prikler <liliana.prikler <at> gmail.com> writes:
> 
> > Am Donnerstag, dem 05.05.2022 um 11:16 +0000 schrieb Attila
> > Lendvai:
> > > at the end of the unpack phase, the working directory is changed
> > > to a
> > > random directory.
> > > 
> > > https://git.savannah.gnu.org/cgit/guix.git/tree/guix/build/gnu-build-system.scm#n178
> > > 
> > > this is fine *when* the archive contains a single dir... but this
> > > DWIM'ness has just burned 15 mintues of my life, and i recommend
> > > removing it.
> 
> > url-fetch/tarbomb: Now this looks like a job for me.
> 
> Just to make sure, are you suggesting the archive type used here
> would have been better handled by url-fetch/tarboom?
That's what the docstring of url-fetch/tarbomb leads me to believe,
yes.  Is it not helpful?




This bug report was last modified 2 years and 337 days ago.

Previous Next


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