1 # Enhance emacs to use the basename(realpath(argv[0])) when looking for
2 # the pdmp file in PATH_EXEC, rather than the basename(argv[0]). This
3 # avoids looking for the pdmp file based on the name of a symlink pointing
4 # at emacs. Emacs is typically run via the mediated /usr/bin/emacs symlink,
5 # which points at one of the emacs variants (emacs-gtk, emacs-x, emacs-nox).
6 # This change allows the actual emacs binary to find its pdump file.
8 # This is an unresolved issue for the upstream emacs community:
10 # https://lists.gnu.org/archive/html/emacs-devel/2021-04/msg00875.html
12 # We will therefore reevaluate it with each update, hoping that future
13 # changes will handle it without a patch.
15 --- emacs-28.2.orig/src/emacs.c 2022-09-06 15:31:54.000000000 -0600
16 +++ emacs-28.2/src/emacs.c 2022-10-12 08:48:04.962420509 -0600
18 This way, they can rename both the executable and its pdump
19 file in PATH_EXEC, and have several Emacs configurations in
20 the same versioned libexec subdirectory. */
22 + /* SOLARIS PATCH: Emacs may be invoked by a symlink, and while that
23 + symlink is typically the mediated /usr/bin/emacs, it can also be
24 + any arbitrary user specified name. As delivered by GNU, stock
25 + emacs will require a pdump file with a matching name to exist
26 + in PATH_EXEC. Rather than examine argv[0], use emacs_executable,
27 + which has been resolved with realpath(), and which will always
28 + point at one of the 3 supported variants we deliver in PATH_EXEC. */
29 + char *argv0 = emacs_executable;
30 char *p, *last_sep = NULL;
31 - for (p = argv[0]; *p; p++)
32 + for (p = argv0; *p; p++)
34 if (IS_DIRECTORY_SEP (*p))
37 - argv0_base = last_sep ? last_sep + 1 : argv[0];
38 + argv0_base = last_sep ? last_sep + 1 : argv0;
39 ptrdiff_t needed = (strlen (path_exec)