emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master d5a18a9 1/2: Remove build system name from determin


From: Paul Eggert
Subject: [Emacs-diffs] master d5a18a9 1/2: Remove build system name from deterministic dumps
Date: Wed, 02 Mar 2016 18:24:15 +0000

branch: master
commit d5a18a93270bfc8c36e40910f8520b3738a91f43
Author: Philipp Stephani <address@hidden>
Commit: Paul Eggert <address@hidden>

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

diff --git a/configure.ac b/configure.ac
index 48d9df1..ad90ce8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -546,6 +546,19 @@ 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, false,
+   [Set this to true to make dumping deterministic.])
+else
+   AC_DEFINE(DETERMINISTIC_DUMP, true,
+   [Set this to true 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 77188a5..ba24964 100644
--- a/lisp/version.el
+++ b/lisp/version.el
@@ -38,12 +38,13 @@ This variable first existed in version 19.23.")
   "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 "elided" (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 c512885..e7cb4ea 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -872,6 +872,9 @@ main (int argc, char **argv)
   SET_BINARY (fileno (stdout));
 #endif /* MSDOS */
 
+  if (DETERMINISTIC_DUMP)
+    Vdeterministic_dump = Qt;
+
   /* 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,
@@ -2532,6 +2535,13 @@ 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 non-nil, attempt to make dumping deterministic by
+avoiding sources of nondeterminism such as absolute file names, the
+hostname, or timestamps.  */);
+  Vdeterministic_dump = DETERMINISTIC_DUMP ? Qt : Qnil;
+  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 418c50d..b01c64d 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1408,6 +1408,13 @@ setup_pty (int fd)
 void
 init_system_name (void)
 {
+  if (DETERMINISTIC_DUMP && (might_dump || ! NILP (Vpurify_flag)))
+    {
+      /* If we're dumping, set the hostname to a literal so that the
+         dump is deterministic.  */
+      Vsystem_name = build_pure_c_string ("elided");
+      return;
+    }
   char *hostname_alloc = NULL;
   char *hostname;
 #ifndef HAVE_GETHOSTNAME



reply via email to

[Prev in Thread] Current Thread [Next in Thread]