public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: nick clifton <nickc@redhat.com>
To: Roland McGrath <mcgrathr@google.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH] GNU_AR_DETERMINISTIC env var, --enable-deterministic-archives
Date: Tue, 13 Dec 2011 13:30:00 -0000	[thread overview]
Message-ID: <4EE7534D.2030800@redhat.com> (raw)
In-Reply-To: <x57jsjkxfl0x.fsf@frobland.mtv.corp.google.com>

Hi Roland,

   Sorry for the delay in responding.  I was waiting to see if any of 
the other maintainers had anything to say on this issue.


> ar member headers are one of the last remaining common barriers to
> reproducible builds (of development packages).  Hence we have the D option.
> But it is devilishly difficult to get the option override--or even AR and
> RANLIB settings pointing to a wrapper script--through configure et al into
> all corners of e.g. the gcc build.
>
> Instead, this change lets the user set the environment variable

Eww, I hate using environment variables like this.  It makes debugging 
so much harder when you cannot rely upon the command line to describe 
how a program was invoked.

I appreciate that the main thrust of this change is to make reproducible 
builds possible without having to do a lot of work changing package 
build scripts.  But I think that that is a poor reason to introduce a 
debugging nightmare like this.

In my opinion it is better to take on the work of changing all of the 
packages one at a time, even if this will be a lot of effort.  On the 
plus side if you do this you can also simplify the package build scripts 
at the same time.  Perhaps by providing a library of useful command 
lines that the scripts can access.  Then future changes like this can be 
simply made by just updating the command line in the library.

We have always resisted using environment variables to control program 
behaviour in projects like gcc and the binutils and I see no reason why 
this policy should change.


That said I have some other comments on the patch (see below).  They are 
more along the lines of commentary on the code for possible future 
reference, rather than acceptance of the patch.


> Users can still set GNU_AR_DETERMINISTIC=0 to reverse
> the build-time default.

But they cannot use a command line option to do this, which strikes me 
as wrong.  If we are going to allow deterministic behaviour to be a 
default then we must also provide a command line option to disable it.

Also - there needs to be some way for the user to find out how the 
particular ar/ranlib that they are using was configured.  Ie they need 
to be able to find out if the default behaviour is for deterministic or 
non-deterministic archives.


> Since D is incompatible with u and some packages run "ar cru",
> when the environment variable or build-time default sets D, we
> just silently ignore u.

I am not happy with this either.  Since "u" has been explicitly 
requested by the user (well the package build script) we should not 
silently ignore it.  If "D" and "u" have both been specified on the 
command line then a fatal warning makes sense.  If on the other hand "D" 
is just the default behaviour then a warning message would make more 
sense.  Then if the user really does want the "u" behaviour and no 
warnings they can add the "not-D" command line option to their build script.


> Ok for trunk?

No, sorry.



> +      const char *env = getenv ("GNU_AR_DETERMINISTIC");
> +      if (env != NULL&&  env[0] != '\0')
> +        {
> +          if (isdigit(env[0]))
> +            {
> +              char *endp = NULL;
> +              long int value = strtol (env,&endp, 0);
> +              if (endp != NULL)
> +                deterministic = value != 0;
> +            }
> +          else
> +            deterministic = 1;

So setting "GNU_AR_DETERMINISTIC=no" will enable determinism...  I admit 
that it matches your proposed new documentation, but it still seems 
counter intuitive.


Cheers
   Nick

  parent reply	other threads:[~2011-12-13 13:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-06 21:28 Roland McGrath
2011-12-08 18:13 ` Roland McGrath
2011-12-13 13:30 ` nick clifton [this message]
2011-12-13 14:52   ` Ian Lance Taylor
2011-12-13 17:32     ` Roland McGrath
2011-12-13 17:44   ` Roland McGrath
2011-12-15 14:41     ` nick clifton
2011-12-15 18:13       ` Roland McGrath

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

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

  git send-email \
    --in-reply-to=4EE7534D.2030800@redhat.com \
    --to=nickc@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=mcgrathr@google.com \
    /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).