unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: Mark H Weaver <mhw@netris.org>
Cc: 20272@debbugs.gnu.org
Subject: bug#20272: Support reproducible builds
Date: Thu, 04 Feb 2016 10:35:48 +0100	[thread overview]
Message-ID: <878u30g6mj.fsf@gnu.org> (raw)
In-Reply-To: <87d1sdqjs2.fsf@netris.org> (Mark H. Weaver's message of "Wed, 03 Feb 2016 21:41:33 -0500")

Mark H Weaver <mhw@netris.org> skribis:

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> Currently .go files embed randomly-generated symbols stemming from
>> ‘syntax-session-id’, which prevents reproducible builds (see
>> <https://lists.gnu.org/archive/html/guix-devel/2013-09/msg00159.html>.)
>>
>> One way to fix it would be to allow users to specify a random seed used
>> when generating session ids, and to make that available as a
>> command-line option to ‘guild compile’.  (GCC does something similar
>> with its ‘-frandom-seed’ option.)
>
> We could add this, but it is not analogous to the -frandom-seed option
> where it is okay to give it the same value everywhere.  Users would need
> to ensure that distinct session-ids are used for every invocation of
> Guile.

With GCC the common idiom is to use ‘-frandom-seed=$source_file’.

However, it would be best if ‘guild compile’ would choose the seed
deterministically by default somehow, because we cannot expect all users
to add the new flag and use properly.

What about having ‘guild compile’ use the canonical file name of the
source being compiled (or a hash thereof) as the seed?

> More precisely, users of this feature would need to observe the
> following restriction, or else unspecified behavior may result:
>
>   If   A.go is generated by a Guile session with session-id A, and
>        B.go is generated by a Guile session with session-id B, and
>   they are both loaded into a Guile session with session-id C, then
>   A, B, and C must all be distinct session-ids.

Right.

I wonder if we could detect collisions.  Ideally each .go could record
its session ID, but that’s probably not feasible in 2.0.

> One more thing: even with a deterministic session-id, the multi-threaded
> compiling of *.go files recently added to Guix will lead to
> non-deterministic outputs.  I'm not sure how to make this work
> deterministically with concurrency.  Even if we switched to a fixed
> number of concurrent processes with one thread each, when process A
> attempts to load a .go file that is produced by process B, it is not
> deterministic whether it will be there.  If it is there, the macros in
> that .go file will contain B's session-id, and if not, they will contain
> A's session-id.

Hmm, OK.  Well, let’s keep this use case aside for now.

>> Probably, ‘syntax-session-id’ would have to be a SRFI-39 parameter
>
> This might adversely affect the efficiency of our macro expander on
> platforms with slow thread local variables, and I'm not sure what it
> would buy us.  If the idea is that it would allow us to build things in
> multiple threads, I think that won't work anyway, for the reasons given
> above.

I was just thinking that it would be a convenient interface for (scripts
compile) to specify the session ID to use.

I think the first thing to do is to change ‘fresh_syntax_session_id’ so
that they can use a user-specified seed, when available, instead of
‘scm_i_random_bytes_from_platform’.

WDYT?

Thanks for working on it!  :-)

Ludo’.





  reply	other threads:[~2016-02-04  9:35 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-07 11:48 bug#20272: Support reproducible builds Ludovic Courtès
2016-02-04  2:41 ` Mark H Weaver
2016-02-04  9:35   ` Ludovic Courtès [this message]
2016-06-20 15:46   ` Andy Wingo
2016-02-11  7:09 ` Mark H Weaver
2016-02-12 16:29   ` Mark H Weaver
2016-06-20 15:48     ` Andy Wingo
2016-06-23 19:22       ` Andy Wingo
2016-11-03  6:54 ` Jan Nieuwenhuizen
2016-11-14 21:44   ` Jan Nieuwenhuizen
2016-12-14 16:25     ` Ludovic Courtès
2016-12-14 23:32       ` Ludovic Courtès
2016-12-14 23:42         ` Ludovic Courtès
2016-12-20 23:00           ` Ludovic Courtès
2016-12-21 23:53             ` Ludovic Courtès
2016-12-30 21:00               ` Ludovic Courtès
2017-03-07 19:55                 ` Ludovic Courtès
2017-02-28 13:26               ` Andy Wingo
2017-03-05 20:49                 ` Ludovic Courtès
2017-03-06 20:13                   ` Andy Wingo
2020-06-01 20:45 ` Andreas Rammhold
2020-06-02 12:25 ` Andreas Rammhold
     [not found] ` <87o8lcu1v8.fsf@gmail.com>
2020-11-24  4:44   ` Vagrant Cascadian
2023-11-17 20:28 ` Bernhard M. Wiedemann
2024-04-08 17:27 ` Thompson, David
2024-04-09  4:02   ` Bernhard M. Wiedemann

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://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878u30g6mj.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=20272@debbugs.gnu.org \
    --cc=mhw@netris.org \
    /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.
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).