mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-08 08:43:52 -08:00
Always set 'Vexec_path' before 'Vinvocation_directory' (bug#43137)
Do this as depending on the OS if argv0 is not populated 'Vexec_path'
is used to infer 'Vinvocation_directory'.
* src/pdumper.c (pdumper_load): Invoke 'init_vars_for_load' instead
of 'set_invocation_vars'.
* src/lisp.h: Extern 'init_vars_for_load' instead of
'set_invocation_vars' .
* src/emacs.c (set_invocation_vars): Make it static and remove
double invocation guard.
(init_vars_for_load): Wrap 'init_callproc_1' and 'set_invocation_vars'
calls + add double invocation guard.
(init_cmdargs): Move out 'set_invocation_vars' invocation.
(main): Call 'init_vars_for_load' instead of 'init_callproc_1'.
This commit is contained in:
parent
29a8d9303b
commit
dc0cf16c7a
3 changed files with 24 additions and 13 deletions
32
src/emacs.c
32
src/emacs.c
|
|
@ -413,16 +413,9 @@ terminate_due_to_signal (int sig, int backtrace_limit)
|
|||
|
||||
/* Set `invocation-name' `invocation-directory'. */
|
||||
|
||||
void
|
||||
static void
|
||||
set_invocation_vars (char *argv0, char const *original_pwd)
|
||||
{
|
||||
/* This function can be called from within pdumper or later during
|
||||
boot. No need to run it twice. */
|
||||
static bool double_run_guard;
|
||||
if (double_run_guard)
|
||||
return;
|
||||
double_run_guard = true;
|
||||
|
||||
Lisp_Object raw_name, handler;
|
||||
AUTO_STRING (slash_colon, "/:");
|
||||
|
||||
|
|
@ -480,6 +473,25 @@ set_invocation_vars (char *argv0, char const *original_pwd)
|
|||
}
|
||||
}
|
||||
|
||||
/* Initialize a number of variables (ultimately
|
||||
'Vinvocation_directory') needed by pdumper to complete native code
|
||||
load. */
|
||||
|
||||
void
|
||||
init_vars_for_load (char *argv0, char const *original_pwd)
|
||||
{
|
||||
/* This function is called from within pdumper while loading (as
|
||||
soon as we are able to allocate) or later during boot if pdumper
|
||||
is not used. No need to run it twice. */
|
||||
static bool double_run_guard;
|
||||
if (double_run_guard)
|
||||
return;
|
||||
double_run_guard = true;
|
||||
|
||||
init_callproc_1 (); /* Must precede init_cmdargs and init_sys_modes. */
|
||||
set_invocation_vars (argv0, original_pwd);
|
||||
}
|
||||
|
||||
|
||||
/* Code for dealing with Lisp access to the Unix command line. */
|
||||
static void
|
||||
|
|
@ -492,8 +504,6 @@ init_cmdargs (int argc, char **argv, int skip_args, char const *original_pwd)
|
|||
initial_argv = argv;
|
||||
initial_argc = argc;
|
||||
|
||||
set_invocation_vars (argv[0], original_pwd);
|
||||
|
||||
Vinstallation_directory = Qnil;
|
||||
|
||||
if (!NILP (Vinvocation_directory))
|
||||
|
|
@ -1788,7 +1798,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
|
|||
/* Init buffer storage and default directory of main buffer. */
|
||||
init_buffer ();
|
||||
|
||||
init_callproc_1 (); /* Must precede init_cmdargs and init_sys_modes. */
|
||||
init_vars_for_load (argv[0], original_pwd);
|
||||
|
||||
/* Must precede init_lread. */
|
||||
init_cmdargs (argc, argv, skip_args, original_pwd);
|
||||
|
|
|
|||
|
|
@ -4430,7 +4430,7 @@ extern bool display_arg;
|
|||
extern Lisp_Object decode_env_path (const char *, const char *, bool);
|
||||
extern Lisp_Object empty_unibyte_string, empty_multibyte_string;
|
||||
extern AVOID terminate_due_to_signal (int, int);
|
||||
extern void set_invocation_vars (char *argv0, char const *original_pwd);
|
||||
extern void init_vars_for_load (char *, char const *);
|
||||
#ifdef WINDOWSNT
|
||||
extern Lisp_Object Vlibrary_cache;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5587,7 +5587,8 @@ pdumper_load (const char *dump_filename, char *argv0, char const *original_pwd)
|
|||
|
||||
/* Once we can allocate and before loading .eln files we must set
|
||||
Vinvocation_directory (.eln paths are relative to it). */
|
||||
set_invocation_vars (argv0, original_pwd);
|
||||
init_vars_for_load (argv0, original_pwd);
|
||||
|
||||
dump_do_all_dump_reloc_for_phase (header, dump_base, LATE_RELOCS);
|
||||
dump_do_all_dump_reloc_for_phase (header, dump_base, VERY_LATE_RELOCS);
|
||||
initialized = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue