From: "Ludovic Courtès" <ludo@gnu.org>
To: Christopher Baines <mail@cbaines.net>
Cc: 35387@debbugs.gnu.org
Subject: bug#35387: unpack phase in the gnu-build-system is sometimes non-deterministic
Date: Tue, 23 Apr 2019 16:36:40 +0200 [thread overview]
Message-ID: <87ef5shjpj.fsf@gnu.org> (raw)
In-Reply-To: <87mukh6vjq.fsf@cbaines.net> (Christopher Baines's message of "Tue, 23 Apr 2019 08:16:25 +0100")
Hi Chris,
Christopher Baines <mail@cbaines.net> 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.
‘file-system-fold’ is just a wrapper around ‘readdir’ 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 ‘scandir’ sorts entries.
Thanks,
Ludo’.
next prev parent reply other threads:[~2019-04-23 14:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-23 7:16 bug#35387: unpack phase in the gnu-build-system is sometimes non-deterministic Christopher Baines
2019-04-23 14:36 ` Ludovic Courtès [this message]
2019-04-30 7:02 ` Christopher Baines
2019-06-14 21:43 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ef5shjpj.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=35387@debbugs.gnu.org \
--cc=mail@cbaines.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).