1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

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.
This commit is contained in:
Philipp Stephani 2016-03-02 10:21:45 -08:00 committed by Paul Eggert
parent a59a4bd47a
commit d5a18a9327
4 changed files with 34 additions and 3 deletions

View File

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

View File

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

View File

@ -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);

View File

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