[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#35387: unpack phase in the gnu-build-system is sometimes non-determi
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 |
User-agent: |
mu4e 1.0; emacs 26.1 |
Ludovic Courtès <address@hidden> writes:
> Hi Chris,
>
> Christopher Baines <address@hidden> 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.
That sounds great :)
signature.asc
Description: PGP signature