klugde finding emacs.pdump * src/emacs.c: (load_pdump): keep going when looking for pdump if one doesn't load because of a bad signature. On linux if basename(argv[0]).pdump isnt found then look at proc/self/exe for the path to the actual executable and try that once that instead of argv[0]. This works if emacs is a symlink. diff --git a/src/emacs.c b/src/emacs.c index fd46540ce2..b95bea7ab1 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -749,6 +749,15 @@ load_pdump (int argc, char **argv) /* Look for a dump file in the same directory as the executable; it should have the same basename. */ +#if defined GNU_LINUX + /* if argv[0].pdmp is not found and argv[0] is a symlink, retry once + with argv[0] set to the link resolved by readlink(2). Lose if + readlink truncates output. */ + char buf[PATH_MAX]; + int ntries = 0; + retry: +#endif + dump_file = alloca (strlen (argv[0]) + strlen (suffix) + 1); #ifdef DOS_NT /* Remove the .exe extension if present. */ @@ -764,7 +773,7 @@ load_pdump (int argc, char **argv) goto out; if (result != PDUMPER_LOAD_FILE_NOT_FOUND) - fatal ("could not load dump file \"%s\": %s", + fprintf (stderr, "could not load dump file \"%s\": %s", dump_file, dump_error_to_string (result)); #ifdef WINDOWSNT @@ -788,7 +797,7 @@ load_pdump (int argc, char **argv) if (result == PDUMPER_LOAD_SUCCESS) goto out; - if (result == PDUMPER_LOAD_FILE_NOT_FOUND) + if (result != PDUMPER_LOAD_SUCCESS) { /* Finally, look for basename(argv[0])+".pdmp" in PATH_EXEC. This way, they can rename both the executable and its pdump @@ -819,6 +828,20 @@ load_pdump (int argc, char **argv) result = pdumper_load (dump_file); } +#if defined GNU_LINUX + if (result != PDUMPER_LOAD_SUCCESS) { + if (++ntries == 2) goto out; + int nbytes = readlink("/proc/self/exe", buf, PATH_MAX); + if (nbytes == -1) { + perror("readlink /proc/self/exe"); + goto out; + } + if (nbytes < sizeof(buf)) buf[nbytes] = 0; + argv[0] = buf; /* XXX use argv0=argv[0] */ + goto retry; + } +#endif + if (result != PDUMPER_LOAD_SUCCESS) { if (result != PDUMPER_LOAD_FILE_NOT_FOUND)