From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christopher Baines Subject: bug#35387: unpack phase in the gnu-build-system is sometimes non-deterministic Date: Tue, 30 Apr 2019 08:02:04 +0100 Message-ID: <87sgu0q8lv.fsf@cbaines.net> References: <87mukh6vjq.fsf@cbaines.net> <87ef5shjpj.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:52818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hLMnD-0001bi-Gm for bug-guix@gnu.org; Tue, 30 Apr 2019 03:03:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hLMn8-00007B-IN for bug-guix@gnu.org; Tue, 30 Apr 2019 03:03:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55217) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hLMn8-000070-Fm for bug-guix@gnu.org; Tue, 30 Apr 2019 03:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hLMn8-0002WC-3A for bug-guix@gnu.org; Tue, 30 Apr 2019 03:03:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-reply-to: <87ef5shjpj.fsf@gnu.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 35387@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > Hi Chris, > > Christopher Baines skribis: > >> I believe that the direnv package has encountered an issue with the >> gnu-build-system [1]. >> >> 1: https://issues.guix.info/issue/35386 >> >> Due to the combination of the 'setup-go-environment phase from the >> go-build-system, and the 'unpack phase of the gnu-build-system, there >> are two directories to be considered by first-subdirectory when called >> from the unpack phase. >> >> It seems from direnv that this either consistently, with the package >> working on one machine, or failing consistently on another. >> >> To avoid issues like this in the future, I think it would be good to >> have first-subdirectory raise an error if it's behaviour could be >> non-deterministic. > > =E2=80=98file-system-fold=E2=80=99 is just a wrapper around =E2=80=98read= dir=E2=80=99 so the order in > which it sees directory entries is non-deterministic. > > What about writing it like this: > > (define (first-subdirectory directory) > "Return the file name of the first sub-directory of DIRECTORY." > (match (scandir directory > (lambda (file) > (and (not (member file '("." ".."))) > (file-is-directory? (string-append directory "= /" > file))))) > ((first . _) first))) > > The result will be deterministic since =E2=80=98scandir=E2=80=99 sorts en= tries. That sounds great :) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlzH8uxfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE 9XfqXQ//aiqO7MFYvGFJ2ejPVQOp8kXlRrf9mQWMfhzAWZNmPilE2BmDks1CFRtG VSS8EpKKAfpRB/7U7iS5UcApxMsTDTKj+VQA0GsAidQFZOskxKbkM5HY5+NP37kX j6csre5ydym3vOWq457g0Oj0xUFRzpzM6JtkNZB3wmGnInU9/H7MQ+u+nH8j92nP MMEA4P5rwHRB7MjZgSwGwh8GZrigu8m/2wwLUq68wl/DzfuQCVL0UuBlPEn0uSpk FNUFm3BWHYRM0InjhPZiDQ7qvXu4XfymDmrKE3/1q5/ZBu5MUgJnOn8rVGUQU5QD wxERxKcf4rVFPqXxVVeip4qqKXv0v950wKVc5p3x4uMVjAclQkAbncNfDBqoLOzB txvA/FPuVNCJGYxGIHe7TQ2LMREJrrBHV0SGde0nTXXNWFOhMCHJfj7NvyBtVDDP 6i6MQW/hD/mxQ2ooQA0nV8rgj7/lu4lorgTLw+xxM4pV7PG8MB/y+2dKuho1B8FX a5wBhY1raUEqc93qhdkJd6vwGr3ajyqejhsU3drSUVTRw5kX2JscLtmD/XQV+dh/ Gagu7YjLdgVFXfE1wjS8en+WbOog4KZ2a08IX+uXQeG0SmHIi/M94ECIUTU5iqYl wMHtADYDbFCnhVo4plZsx8VOA8l6tgqrP6HXvn4QDmoMoRgEGVQ= =RtLT -----END PGP SIGNATURE----- --=-=-=--