unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Paul Eggert <eggert@cs.ucla.edu>, Eli Zaretskii <eliz@gnu.org>,
	emacs-devel@gnu.org
Subject: Re: [PATCH PING] Honor 'SOURCE_DATE_EPOCH' when generating autoloads.
Date: Wed, 23 Dec 2015 16:01:30 +0000	[thread overview]
Message-ID: <CAArVCkS_5nh4X5pmNRRCN9uqK-vEaU1A0PyND=ccYpEUkO-sfQ@mail.gmail.com> (raw)
In-Reply-To: <m21taermpo.fsf@newartisans.com>


[-- Attachment #1.1: Type: text/plain, Size: 516 bytes --]

John Wiegley <jwiegley@gmail.com> schrieb am Mi., 23. Dez. 2015 um
02:13 Uhr:

> >>>>> Paul Eggert <eggert@cs.ucla.edu> writes:
>
> > Instead, I suggest making it a configure-time option, e.g.,
> >   ./configure --enable-deterministic-build
>
> I'd prefer a configuration options too.
>
> > I suppose Emacs code could also set the new Elisp deterministic-build
> > variable that you're suggesting, to override the configure-time default.
> But
> > not an environment variable, please.
>
> +1
>
>
OK, here's a patch.

[-- Attachment #1.2: Type: text/html, Size: 934 bytes --]

[-- Attachment #2: 0001-Remove-build-system-name-from-deterministic-dumps.patch --]
[-- Type: application/octet-stream, Size: 4293 bytes --]

From d91d9af6f141a913a34a234b166adc6919ebc69d Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Sun, 20 Dec 2015 01:57:34 +0100
Subject: [PATCH] Remove build system name from deterministic dumps.

* configure.ac (DETERMINISTIC_DUMP): New configuration option.
* emacs.c (main): Initialize `deterministic-dump' from the
  configuration option.
  (syms_of_emacs): New constant `deterministic-dump'.
* sysdep.c (init_system_name): Use a constant if a deterministic dump is
  requested.
* version.el (emacs-build-time): Add a comment to make the build time
  deterministic if requested.
  (emacs-build-system): Make variable deterministic if requested.
---
 configure.ac    | 10 ++++++++++
 lisp/version.el |  7 ++++---
 src/emacs.c     | 15 +++++++++++++++
 src/sysdep.c    |  9 +++++++++
 4 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0b7b403..b1b7181 100644
--- a/configure.ac
+++ b/configure.ac
@@ -542,6 +542,16 @@ AC_ARG_ENABLE(gtk-deprecation-warnings,
 		[Show Gtk+/Gdk deprecation warnings for Gtk+ >= 3.0])],
 [ac_enable_gtk_deprecation_warnings="${enableval}"],[])
 
+AC_ARG_ENABLE(deterministic-dump,
+[AS_HELP_STRING([--enable-deterministic-dump],
+                [Make dumping deterministic by removing system-specific
+                information from the dump, such as host names and
+                timestamps.])])
+if test "x${enableval}" != xno ; then
+   AC_DEFINE(DETERMINISTIC_DUMP, 1,
+   [Define this to make dumping deterministic.])
+fi
+
 dnl This used to use changequote, but, apart from 'changequote is evil'
 dnl per the autoconf manual, we can speed up autoconf somewhat by quoting
 dnl the great gob of text.  Thus it's not processed for possible expansion.
diff --git a/lisp/version.el b/lisp/version.el
index 43103fd..6af80c6 100644
--- a/lisp/version.el
+++ b/lisp/version.el
@@ -38,12 +38,13 @@ emacs-minor-version
   "Minor version number of this version of Emacs.
 This variable first existed in version 19.23.")
 
+;; FIXME: The next variable should also be a constant if
+;; `deterministic-dump' is t.
 (defconst emacs-build-time (current-time)
   "Time at which Emacs was dumped out.")
 
-;; I think this should be obsoleted/removed.  It's just one more meaningless
-;; difference between different builds.  It's usually not even an fqdn.
-(defconst emacs-build-system (system-name)
+(defconst emacs-build-system
+  (if deterministic-dump "unknown" (system-name))
   "Name of the system on which Emacs was built.")
 
 (defvar motif-version-string)
diff --git a/src/emacs.c b/src/emacs.c
index 2e9f950..ac9e524 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -925,6 +925,10 @@ main (int argc, char **argv)
   SET_BINARY (fileno (stdout));
 #endif /* MSDOS */
 
+#ifdef DETERMINISTIC_DUMP
+  Vdeterministic_dump = Qt;
+#endif /* DETERMINISTIC_DUMP */
+
   /* Skip initial setlocale if LC_ALL is "C", as it's not needed in that case.
      The build procedure uses this while dumping, to ensure that the
      dumped Emacs does not have its system locale tables initialized,
@@ -2566,6 +2570,17 @@ libraries; only those already known by Emacs will be loaded.  */);
   Vdynamic_library_alist = Qnil;
   Fput (intern_c_string ("dynamic-library-alist"), Qrisky_local_variable, Qt);
 
+  DEFVAR_BOOL ("deterministic-dump", Vdeterministic_dump,
+    doc: /* If t, attempt to make dumping deterministic by avoiding
+sources of nondeterminism such as absolute paths, the hostname, or
+timestamps.  */);
+#ifdef DETERMINISTIC_DUMP
+  Vdeterministic_dump = Qt;
+#else
+  Vdeterministic_dump = Qnil;
+#endif
+  XSYMBOL (intern_c_string ("deterministic-dump"))->constant = 1;
+
 #ifdef WINDOWSNT
   Vlibrary_cache = Qnil;
   staticpro (&Vlibrary_cache);
diff --git a/src/sysdep.c b/src/sysdep.c
index 1af323e..ea322a0 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1399,6 +1399,15 @@ setup_pty (int fd)
 void
 init_system_name (void)
 {
+#ifdef DETERMINISTIC_DUMP
+  if (might_dump)
+    {
+      /* If we're dumping, set the hostname to a literal so that the
+         dump is deterministic.  */
+      Vsystem_name = build_pure_c_string ("unknown");
+      return;
+    }
+#endif /* DETERMINISTIC_DUMP */
   char *hostname_alloc = NULL;
   char *hostname;
 #ifndef HAVE_GETHOSTNAME
-- 
2.6.3


  reply	other threads:[~2015-12-23 16:01 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-16 17:03 [PATCH] Honor 'SOURCE_DATE_EPOCH' when generating autoloads Ludovic Courtès
2015-11-29 10:44 ` [PATCH PING] " Ludovic Courtès
2015-11-29 16:02   ` Eli Zaretskii
2015-11-29 16:57     ` Ludovic Courtès
2015-11-29 18:12       ` Eli Zaretskii
2015-11-29 20:38         ` Ludovic Courtès
2015-11-30 17:00         ` John Wiegley
2015-11-30 19:30           ` Ludovic Courtès
2015-12-07 18:36             ` Philipp Stephani
2015-12-07 18:58               ` Paul Eggert
2015-12-07 19:00                 ` Philipp Stephani
2015-12-07 19:14                   ` Paul Eggert
2015-12-20 12:48                     ` Philipp Stephani
2015-12-20 16:37                       ` Eli Zaretskii
2015-12-20 18:39                         ` Philipp Stephani
2015-12-20 19:03                           ` Eli Zaretskii
2015-12-20 21:27                           ` Paul Eggert
2015-12-23  1:13                             ` John Wiegley
2015-12-23 16:01                               ` Philipp Stephani [this message]
2015-12-23 16:39                                 ` Eli Zaretskii
2015-12-23 16:52                                   ` Philipp Stephani
2015-12-23 17:10                                     ` Eli Zaretskii
2015-12-23 17:38                                       ` Philipp Stephani
2015-12-23 21:09                                         ` Paul Eggert
2015-12-24  3:33                                           ` Eli Zaretskii
2015-12-24  6:54                                             ` Paul Eggert
2015-12-24 16:18                                               ` Eli Zaretskii
2015-12-27  9:53                                     ` Philipp Stephani
2015-12-27 16:10                                       ` Eli Zaretskii
2016-02-29 21:52                                         ` Philipp Stephani
2016-03-01 16:36                                           ` Paul Eggert
2016-03-01 21:46                                             ` Philipp Stephani
2016-03-02 18:24                                               ` Paul Eggert
2016-03-02 18:30                                                 ` Philipp Stephani
2016-03-22 13:30                                                   ` Philipp Stephani
2016-03-22 20:37                                                     ` Paul Eggert
2016-03-22 21:46                                                       ` Philipp Stephani
2016-03-22 21:58                                                         ` Paul Eggert
2016-03-23  8:03                                                         ` Andreas Schwab
2016-04-06 21:29                                                           ` Philipp Stephani
2015-12-27 23:26                                       ` Paul Eggert
2015-12-28 16:26                                         ` Eli Zaretskii
2015-12-28 18:00                                           ` Paul Eggert
2015-12-28 18:23                                             ` Eli Zaretskii
2015-12-29  3:01                                               ` Paul Eggert
2015-12-29 15:38                                                 ` Eli Zaretskii
2015-12-29 16:47                                                   ` Paul Eggert
2015-12-29 17:59                                                     ` Eli Zaretskii
2015-12-29 20:33                                                       ` Paul Eggert
2015-12-07 23:11               ` Ludovic Courtès
2015-11-30  9:22       ` Alex Kost
2015-11-29 20:22   ` Paul Eggert
2015-11-29 20:42     ` 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://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='CAArVCkS_5nh4X5pmNRRCN9uqK-vEaU1A0PyND=ccYpEUkO-sfQ@mail.gmail.com' \
    --to=p.stephani2@gmail.com \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).