summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emacs.c10
-rw-r--r--src/sysdep.c7
2 files changed, 17 insertions, 0 deletions
diff --git a/src/emacs.c b/src/emacs.c
index c512885076c..e7cb4ea4aaa 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 418c50d5e78..b01c64d52ac 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