From b29b79efd9752caf1e99273575a00b6769ddad56 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 3 Apr 2019 20:30:23 +0300 Subject: [PATCH] Restore process-environment after portable dumping * src/pdumper.c (struct dump_context): New member old_process_environment. (Fdump_emacs_portable): Record the original value of process-environment. (dump_unwind_cleanup): Restore the original values of process-environment and post-gc-hook. --- src/pdumper.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/pdumper.c b/src/pdumper.c index 53a10b62b3f..7fabfa771ce 100644 --- a/src/pdumper.c +++ b/src/pdumper.c @@ -495,6 +495,7 @@ struct dump_context Lisp_Object old_purify_flag; Lisp_Object old_post_gc_hook; + Lisp_Object old_process_environment; #ifdef REL_ALLOC bool blocked_ralloc; @@ -3593,6 +3594,8 @@ dump_unwind_cleanup (void *data) r_alloc_inhibit_buffer_relocation (0); #endif Vpurify_flag = ctx->old_purify_flag; + Vpost_gc_hook = ctx->old_post_gc_hook; + Vprocess_environment = ctx->old_process_environment; } /* Return DUMP_OFFSET, making sure it is within the heap. */ @@ -4024,12 +4027,6 @@ types. */) Lisp_Object symbol = intern ("command-line-processed"); specbind (symbol, Qnil); - /* Reset process-environment -- this is for when they re-dump a - pdump-restored emacs, since set_initial_environment wants always - to cons it from scratch. */ - Vprocess_environment = Qnil; - garbage_collect (); - CHECK_STRING (filename); filename = Fexpand_file_name (filename, Qnil); filename = ENCODE_FILE (filename); @@ -4091,6 +4088,12 @@ types. */) ctx->old_post_gc_hook = Vpost_gc_hook; Vpost_gc_hook = Qnil; + /* Reset process-environment -- this is for when they re-dump a + pdump-restored emacs, since set_initial_environment wants always + to cons it from scratch. */ + ctx->old_process_environment = Vprocess_environment; + Vprocess_environment = Qnil; + ctx->fd = emacs_open (SSDATA (filename), O_RDWR | O_TRUNC | O_CREAT, 0666); if (ctx->fd < 0) -- 2.39.2