aboutsummaryrefslogtreecommitdiffstats
path: root/src/callproc.c
diff options
context:
space:
mode:
authorPaul Eggert2025-07-24 14:49:52 -0700
committerPaul Eggert2025-07-24 22:13:47 -0700
commiteb9ec79c13f17d610fcb6de49628b8a7686fbab7 (patch)
tree65229f340d83d020275e5f28b640d7b4d2722827 /src/callproc.c
parent6a08a9a54d4ff5aafe795c7a079709993c08dff3 (diff)
downloademacs-eb9ec79c13f17d610fcb6de49628b8a7686fbab7.tar.gz
emacs-eb9ec79c13f17d610fcb6de49628b8a7686fbab7.zip
PATH defaults now act more like GNU and POSIX
When PATH is unset or empty, use the system default, to be consistent with GNU/Linux and with POSIX. If there is no system default do not default to "." as that can be dangerous. * src/callproc.c (init_callproc_1, init_callproc): Default PATH to the null pointer, not the empty string. * src/emacs.c (default_PATH): New function. (find_emacs_executable, decode_env_path): Be consistent with POSIX and with glibc about what to do when PATH is unset or empty.
Diffstat (limited to 'src/callproc.c')
-rw-r--r--src/callproc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/callproc.c b/src/callproc.c
index 7059a2bac6f..e1a369b47f4 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1960,7 +1960,7 @@ init_callproc_1 (void)
1960 Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC, 0); 1960 Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC, 0);
1961 Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path)); 1961 Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path));
1962 /* FIXME? For ns, path_exec should go at the front? */ 1962 /* FIXME? For ns, path_exec should go at the front? */
1963 Vexec_path = nconc2 (decode_env_path ("PATH", "", 0), Vexec_path); 1963 Vexec_path = nconc2 (decode_env_path ("PATH", NULL, 0), Vexec_path);
1964} 1964}
1965 1965
1966/* This is run after init_cmdargs, when Vinstallation_directory is valid. */ 1966/* This is run after init_cmdargs, when Vinstallation_directory is valid. */
@@ -1985,7 +1985,7 @@ init_callproc (void)
1985 { 1985 {
1986 /* Running uninstalled, so default to tem rather than PATH_EXEC. */ 1986 /* Running uninstalled, so default to tem rather than PATH_EXEC. */
1987 Vexec_path = decode_env_path ("EMACSPATH", SSDATA (tem), 0); 1987 Vexec_path = decode_env_path ("EMACSPATH", SSDATA (tem), 0);
1988 Vexec_path = nconc2 (decode_env_path ("PATH", "", 0), Vexec_path); 1988 Vexec_path = nconc2 (decode_env_path ("PATH", NULL, 0), Vexec_path);
1989 } 1989 }
1990 1990
1991 Vexec_directory = Ffile_name_as_directory (tem); 1991 Vexec_directory = Ffile_name_as_directory (tem);