From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.bugs Subject: bug#34180: 27.0.50; argv[0] used incorrectly to find the .pdmp Date: Mon, 11 Oct 2021 13:13:18 -0700 Message-ID: <97e17ac7-b46f-5cac-e0da-8a8f1e26813b@dancol.org> References: <5d5d6da7-d0d4-82ae-8034-78d47a6b12c8@dancol.org> <83va2a3z0d.fsf@gnu.org> <87wnmjhd6j.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11211"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 Cc: 34180@debbugs.gnu.org, monnier@IRO.UMontreal.CA To: Paul Eggert , Lars Ingebrigtsen , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 11 22:14:33 2021 Return-path: Envelope-to: geb-bug-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 1ma1gu-0002gQ-IJ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Oct 2021 22:14:33 +0200 Original-Received: from localhost ([::1]:37762 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ma1gs-00008x-Hm for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 11 Oct 2021 16:14:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ma1gQ-00008Z-Nd for bug-gnu-emacs@gnu.org; Mon, 11 Oct 2021 16:14:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49451) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ma1gQ-0001rC-Fo for bug-gnu-emacs@gnu.org; Mon, 11 Oct 2021 16:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ma1gQ-0003Hc-8s for bug-gnu-emacs@gnu.org; Mon, 11 Oct 2021 16:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Colascione Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Oct 2021 20:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34180 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: security Original-Received: via spool by 34180-submit@debbugs.gnu.org id=B34180.163398320512506 (code B ref 34180); Mon, 11 Oct 2021 20:14:02 +0000 Original-Received: (at 34180) by debbugs.gnu.org; 11 Oct 2021 20:13:25 +0000 Original-Received: from localhost ([127.0.0.1]:60997 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ma1fo-0003Fd-Qs for submit@debbugs.gnu.org; Mon, 11 Oct 2021 16:13:25 -0400 Original-Received: from dancol.org ([96.126.100.184]:42268) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ma1fm-0003FV-QP for 34180@debbugs.gnu.org; Mon, 11 Oct 2021 16:13:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=746yxaiYwmLTEdMJyW2BDk91fYzLotFOZ4vQagXthQU=; b=JynoPT6o9cIlQDRYbqN1GjgnPQ V7oi+/un7i6JoPpICR30CzV3JBri+cnW7hAJd9pjDDLPh7wB9K4GYO5u7aoeB4bOtqmnyPF+0dE+a jHzMV0AsYQjxHwj7QtBbo18oLADR17MgwhXVavYLgdragVHAe+XakAWDOfE5B++HVooDcCzXWUcsp wXYDeh5EB2fYyMYCzQr8CNuEjZSxaOATUT2cN5x5n7xaBGemZABe8fD+Fd4DHq5Iq5nmdbuPJODQI 1yQoUej3DUrcJqZyyc8jBj84uG5ZQPMIsNwqV1bNCWpjp1T8j8PsuNmlTjp8Hl5SC/zwTDBxJwa6/ dUPQnL8w==; Original-Received: from [2604:4080:1321:8020:e350:5296:4f0b:6c8d] (port=53850) by dancol.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1ma1fk-0001Tl-4k; Mon, 11 Oct 2021 13:13:20 -0700 In-Reply-To: Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:216959 Archived-At: On 10/11/21 8:10 AM, Paul Eggert wrote: > On 10/11/21 7:02 AM, Lars Ingebrigtsen wrote: >> It looks like find_executable from progreloc in gnulib provides a >> portable interface for this? > > It does, although it drags in a bunch of other Gnulib modules, as this > stuff is wildly system-dependent. > > For ordinary Emacs installation, I've long thought that a better > approach is to store the default .pdmp file as a readonly char array > within the Emacs executable itself. This would be easier for installers, > sysadmins and users, as it would entail no funny rules about installing > two files, keeping them in sync, symlinks, PATH, argv[0], relative > names, security, etc. It's not quite that simple though. The pdmp file includes offsets of data structures within the Emacs executable. Rebuilding the executable with a big char array will change these offsets and invalidate the pdmp blob you're trying to embed. Now, you could try to guess the size of the blob ahead of time, include a dummy embedded array of that size in Emacs, dump, and then overwrite the embedded array post-build, but there's no guarantee that doing that would actually work on all systems. I'd rather get out of the business of mucking with executable files even if it means we have a bit of extra complexity arising from having to deal with out-of-band pdmp files.