From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Jos=C3=A9_Manuel_Garc=C3=ADa-Patos?= Newsgroups: gmane.emacs.help Subject: Emacs 27.1 - Issue with pdumper Date: Thu, 27 Aug 2020 23:32:33 +0200 Message-ID: <20200827213233.GA2558@cervantes.ciudades-secretas.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="WIyZ46R2i8wDzkSu" Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31371"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Aug 27 23:34:50 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kBPXl-000849-RQ for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 27 Aug 2020 23:34:49 +0200 Original-Received: from localhost ([::1]:44572 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBPXk-0001n1-K5 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 27 Aug 2020 17:34:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBPWX-00016c-2Z for help-gnu-emacs@gnu.org; Thu, 27 Aug 2020 17:33:33 -0400 Original-Received: from cpanel52.fastsecurehost.com ([92.51.247.56]:37288) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBPWU-0008UJ-LY for help-gnu-emacs@gnu.org; Thu, 27 Aug 2020 17:33:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gesaku.es; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Subject:To:From:Date:Sender:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=sawj4bKKmAJm2s6/+5UlI5HLj8k7yVqxkRnHJ9BGyVQ=; b=bSY/h8H8GtkdLev+E2oZk71vlt hb03ODsAfQvh4nrosdYGhhTvA+bGSJdSoF3XQ0RbheZVq22re1f1b9YEA5tf2N3K8SPsMjktHR+he JlH7gMBogXQvJgD2FujhIeXXXbWCw4Qg9wQvm4b+O1f1lTRaWgvFsQwnL4JJX2ASK+uHwmXn4G7TQ bySM1UHmp9CADmKdFna7Bg759zyoxdOUcD0Qb9GuoBOWSLG3N3GjgzbBpsEBhD2o7/FDYRXTVv6I9 gmEkHvHuTHQF0LTCavN0m9F81OJXMkooIoOq0Mi2Ym3GlhUxqKALGKCjmIGsi5vOUZzNq9hA9MMiH YtJjQtAQ==; X-fastsecurehost-MailScanner-From: jm.inform@gesaku.es X-fastsecurehost-MailScanner: Found to be clean X-fastsecurehost-MailScanner-ID: 1kBPVe-00FmCv-Tg X-fastsecurehost-MailScanner-Information: Please contact the ISP for more information Original-Received: from 111.134.94.90.dynamic.jazztel.es ([90.94.134.111]:40968 helo=cervantes.ciudades-secretas.net) by cpanel52.fastsecurehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1kBPVe-00FmCv-Tg for help-gnu-emacs@gnu.org; Thu, 27 Aug 2020 22:32:39 +0100 Content-Disposition: inline X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cpanel52.fastsecurehost.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - gesaku.es X-Get-Message-Sender-Via: cpanel52.fastsecurehost.com: authenticated_id: jm.inform@gesaku.es X-Authenticated-Sender: cpanel52.fastsecurehost.com: jm.inform@gesaku.es Received-SPF: pass client-ip=92.51.247.56; envelope-from=jm.inform@gesaku.es; helo=cpanel52.fastsecurehost.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/27 17:32:47 X-ACL-Warn: Detected OS = Linux 3.1-3.10 X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:123809 Archived-At: --WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hello, I'm using GNU Emacs 27.1 on Slackware Linux. This last piece of information is important because the way Emacs is packaged here is through a double compilation which results in two different binaries: One with support for X and one without. The latter can be used for things like editing git commit messages or composing email messages with Mutt, like I'm doing right now. Anyway, the issue I (and all other Slackware users, I suppose) have with pdumper is that there is no way to create two different .pdmp files (because emacs.pdmp is hardcoded). That means the second binary can never run and instead fails with the following error: desired fingerprint: b1af5fedf3d750a1ba93f43999aa141cf316edd0bb344916fb5529aea2cf68e2 found fingerprint: 8093d49d8a9b7b588b1f66b4bafad1f9f5e0dc766973ba4d83e38d25cfa96e4e emacs: could not load dump file "/usr/libexec/emacs/27.1/x86_64-slackware-linux/emacs.pdmp": not built for this Emacs executable The most obvious workaround is to rename the .pdmp file created during the second compilation, right after it and before the actual packaging, but that doesn't work because Emacs' code checks for ‘emacs.pdmp’ before ‘emacs-no-x11.pdmp’ (or whatever name we want to give it), hence the error above. You might argue that there's the option --dump-file=FILE, but having to use that would defeat the purpose of installing something and having it just work. So, I'd like to suggest a modification to the function load_pdump() in the file emacs.c consisting of changing its order of evaluation, leaving the search for emacs.pdmp (the default case) for last and trying to find .pdmp before that. I've tried this change myself and it works, which is the reason why I'm able to compose this email. I have attached a diff file in case you want to use it as orientation or as is. I think leaving the (hardcoded) default case for last makes sense, and it would help us a lot, as we would only have to change one line in the packaging script. Thank you. -- José Manuel García-Patos Madrid --WIyZ46R2i8wDzkSu Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="emacs-git.diff" diff --git a/src/emacs.c b/src/emacs.c index 059e1c6d8f..ad92fd6fca 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -864,15 +864,51 @@ load_pdump (int argc, char **argv) path_exec = w32_relocate (path_exec); #endif - /* Look for "emacs.pdmp" in PATH_EXEC. We hardcode "emacs" in - "emacs.pdmp" so that the Emacs binary still works if the user - copies and renames it. */ - const char *argv0_base = "emacs"; + /* Look for basename(argv0)+".pdmp" in PATH_EXEC. + This way, they can rename both the executable and its pdump + file in PATH_EXEC, and have several Emacs configurations in + the same versioned libexec subdirectory. */ + char *p, *last_sep = NULL; + for (p = argv[0]; *p; p++) + { + if (IS_DIRECTORY_SEP (*p)) + last_sep = p; + } + const char *argv0_base = last_sep ? last_sep + 1 : argv[0]; ptrdiff_t needed = (strlen (path_exec) + 1 + strlen (argv0_base) + strlen (suffix) + 1); + if (bufsize < needed) + { + xfree (dump_file); + dump_file = xmalloc (needed); + } +#ifdef DOS_NT + ptrdiff_t argv0_len = strlen (argv0_base); + if (argv0_len >= 4 + && c_strcasecmp (argv0_base + argv0_len - 4, ".exe") == 0) + sprintf (dump_file, "%s%c%.*s%s", path_exec, DIRECTORY_SEP, + (int)(argv0_len - 4), argv0_base, suffix); + else +#endif + sprintf (dump_file, "%s%c%s%s", + path_exec, DIRECTORY_SEP, argv0_base, suffix); + result = pdumper_load (dump_file); + + if (result == PDUMPER_LOAD_SUCCESS) + goto out; + + /* Finally, look for "emacs.pdmp" in PATH_EXEC. We hardcode "emacs" in + "emacs.pdmp" so that the Emacs binary still works if the user + copies and renames it. */ + argv0_base = "emacs"; + needed = (strlen (path_exec) + + 1 + + strlen (argv0_base) + + strlen (suffix) + + 1); if (bufsize < needed) { xfree (dump_file); @@ -882,42 +918,6 @@ load_pdump (int argc, char **argv) path_exec, DIRECTORY_SEP, argv0_base, suffix); result = pdumper_load (dump_file); - if (result == PDUMPER_LOAD_FILE_NOT_FOUND) - { - /* Finally, look for basename(argv0)+".pdmp" in PATH_EXEC. - This way, they can rename both the executable and its pdump - file in PATH_EXEC, and have several Emacs configurations in - the same versioned libexec subdirectory. */ - char *p, *last_sep = NULL; - for (p = argv[0]; *p; p++) - { - if (IS_DIRECTORY_SEP (*p)) - last_sep = p; - } - argv0_base = last_sep ? last_sep + 1 : argv[0]; - ptrdiff_t needed = (strlen (path_exec) - + 1 - + strlen (argv0_base) - + strlen (suffix) - + 1); - if (bufsize < needed) - { - xfree (dump_file); - dump_file = xmalloc (needed); - } -#ifdef DOS_NT - ptrdiff_t argv0_len = strlen (argv0_base); - if (argv0_len >= 4 - && c_strcasecmp (argv0_base + argv0_len - 4, ".exe") == 0) - sprintf (dump_file, "%s%c%.*s%s", path_exec, DIRECTORY_SEP, - (int)(argv0_len - 4), argv0_base, suffix); - else -#endif - sprintf (dump_file, "%s%c%s%s", - path_exec, DIRECTORY_SEP, argv0_base, suffix); - result = pdumper_load (dump_file); - } - if (result != PDUMPER_LOAD_SUCCESS) { if (result != PDUMPER_LOAD_FILE_NOT_FOUND) --WIyZ46R2i8wDzkSu--