From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: Preview: portable dumper Date: Fri, 16 Feb 2018 07:02:33 -0800 Message-ID: <62c0d971-bc9e-749d-84ba-a206ffb49409@dancol.org> References: <4c5d130f-d8ae-d109-613d-0df13d8c40e4@cs.ucla.edu> <83f00146-dc4f-1048-73b5-c41ff942058b@dancol.org> <83mv09e3qk.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1518793315 21729 195.159.176.226 (16 Feb 2018 15:01:55 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 16 Feb 2018 15:01:55 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 Cc: alan@idiocy.org, eggert@cs.ucla.edu, angelo.g0@libero.it, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 16 16:01:50 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1emhVR-00029k-VR for ged-emacs-devel@m.gmane.org; Fri, 16 Feb 2018 16:00:58 +0100 Original-Received: from localhost ([::1]:58015 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emhXT-0005OZ-S1 for ged-emacs-devel@m.gmane.org; Fri, 16 Feb 2018 10:03:03 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50013) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emhXG-0005Ng-Nd for emacs-devel@gnu.org; Fri, 16 Feb 2018 10:02:51 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emhXA-0005b2-Kr for emacs-devel@gnu.org; Fri, 16 Feb 2018 10:02:50 -0500 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:43030) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1emhXA-0005aX-A3; Fri, 16 Feb 2018 10:02:44 -0500 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; bh=RjZ7RU74LG2sygImOv7YfUsnM5L/MdiPtMwd0pc6Q4M=; b=qNbBu/8tzqg/XsKXb/CAvhPCrsTwErm96tB+8VyxTpOVK+fICprn/f7p/9RePLcE9IVR+knB46bfduKRGq0C6RjD7fD/KqDNC99d407b/fZIaKaIYQVJsMuFr+Nt9uJR6g/gjJRqLx16ZDQ6LwNUclUHgBpGkn3l437Atj/eus90OfMtYQ4b8/9kUkj91l9DWzUM5M134EnTs3M7aYt2qcB9OoggkBjOVQf9sLEuJ01kxLKe/Nq/y1niEna2K1MXBbjhpj0ZXQ1B1f1vYIi3Eg7Ic3pJHYS/abEFJShQ4PwRXoDj8/5UusrQ5UwAJp1sLiQM6Lpb1+fl5U2dD7cZ5g==; Original-Received: from [2604:4080:1321:8ab0:717a:f892:f8e7:f978] by dancol.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1emhX6-00071o-AH; Fri, 16 Feb 2018 07:02:40 -0800 In-Reply-To: <83mv09e3qk.fsf@gnu.org> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2600:3c01::f03c:91ff:fedf:adf3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:222813 Archived-At: On 02/16/2018 12:30 AM, Eli Zaretskii wrote: >> Cc: Eli Zaretskii , Angelo Graziosi , >> emacs-devel@gnu.org >> From: Daniel Colascione >> Date: Thu, 15 Feb 2018 17:07:29 -0800 >> >> A simpler approach would be to just concatenate the dump to temacs, then >> add a special header with a signature and a dump length. > > But it will have to be a special section, right? Because otherwise we > again will prevent Binutils from doing useful stuff with such an > executable, right? Just concatenating bytes to the end of an executable doesn't break that executable, at least not on any platform I know about. binutils keeps working. No special section required. Strip does remove the extra data though, unfortunately, and this procedure does break any cryptographic signatures (although we're not using any right now). ~/edev/trunk/src $ readelf -h ./emacs ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Advanced Micro Devices X86-64 Version: 0x1 Entry point address: 0x41e9f0 Start of program headers: 64 (bytes into file) Start of section headers: 51310168 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 56 (bytes) Number of program headers: 9 Size of section headers: 64 (bytes) Number of section headers: 41 Section header string table index: 40 ~/edev/trunk/src $ ./emacs -batch -Q --eval '(kill-emacs)' ~/edev/trunk/src $ unzip -t kittens.zip Archive: kittens.zip testing: kittens.jpg OK No errors detected in compressed data of kittens.zip. ~/edev/trunk/src $ cat emacs kittens.zip > emacs-with-kittens ~/edev/trunk/src $ readelf -h ./emacs-with-kittens ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Advanced Micro Devices X86-64 Version: 0x1 Entry point address: 0x41e9f0 Start of program headers: 64 (bytes into file) Start of section headers: 51310168 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 56 (bytes) Number of program headers: 9 Size of section headers: 64 (bytes) Number of section headers: 41 Section header string table index: 40 ~/edev/trunk/src $ chmod +x emacs-with-kittens ~/edev/trunk/src $ ./emacs-with-kittens -batch -Q --eval '(kill-emacs)' ~/edev/trunk/src $ unzip -t emacs-with-kittens Archive: emacs-with-kittens warning [emacs-with-kittens]: 51312792 extra bytes at beginning or within zipfile (attempting to process anyway) testing: kittens.jpg OK No errors detected in compressed data of emacs-with-kittens.