unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35387: unpack phase in the gnu-build-system is sometimes non-deterministic
@ 2019-04-23  7:16 Christopher Baines
  2019-04-23 14:36 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Christopher Baines @ 2019-04-23  7:16 UTC (permalink / raw)
  To: 35387

[-- Attachment #1: Type: text/plain, Size: 664 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#35387: unpack phase in the gnu-build-system is sometimes non-deterministic
  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
  2019-04-30  7:02   ` Christopher Baines
  2019-06-14 21:43   ` Ludovic Courtès
  0 siblings, 2 replies; 4+ messages in thread
From: Ludovic Courtès @ 2019-04-23 14:36 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 35387

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’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#35387: unpack phase in the gnu-build-system is sometimes non-deterministic
  2019-04-23 14:36 ` Ludovic Courtès
@ 2019-04-30  7:02   ` Christopher Baines
  2019-06-14 21:43   ` Ludovic Courtès
  1 sibling, 0 replies; 4+ messages in thread
From: Christopher Baines @ 2019-04-30  7:02 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 35387

[-- Attachment #1: Type: text/plain, Size: 1536 bytes --]


Ludovic Courtès <ludo@gnu.org> writes:

> 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.

That sounds great :)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 962 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#35387: unpack phase in the gnu-build-system is sometimes non-deterministic
  2019-04-23 14:36 ` Ludovic Courtès
  2019-04-30  7:02   ` Christopher Baines
@ 2019-06-14 21:43   ` Ludovic Courtès
  1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2019-06-14 21:43 UTC (permalink / raw)
  To: Christopher Baines; +Cc: 35387-done

Ludovic Courtès <ludo@gnu.org> skribis:

> 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.

Pushed as cfd4e4d06e3cda0f3eed8d6b9277ce53e55404b8 on ‘core-updates’.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-14 21:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2019-04-30  7:02   ` Christopher Baines
2019-06-14 21:43   ` Ludovic Courtès

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).