From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#48137: 27.2; `package-install-file' fails when loading a package file with DOS line endings Date: Tue, 11 May 2021 15:55:31 +0300 Message-ID: <831rad5t18.fsf@gnu.org> References: <834kfmabvs.fsf@gnu.org> <83tunj651i.fsf@gnu.org> <83lf8u68bu.fsf@gnu.org> <83mtta4gtf.fsf@gnu.org> <83fsz24f2x.fsf@gnu.org> <83v97x2xum.fsf@gnu.org> <83bl9nevd3.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17469"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 48137@debbugs.gnu.org, monnier@iro.umontreal.ca To: Ioannis Kappas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 11 14:56:32 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 1lgRw8-0004OS-PG for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 11 May 2021 14:56:32 +0200 Original-Received: from localhost ([::1]:48312 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgRw7-0004bh-SL for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 11 May 2021 08:56:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgRvf-0004XO-Q1 for bug-gnu-emacs@gnu.org; Tue, 11 May 2021 08:56:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52008) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lgRvf-0005ui-J3 for bug-gnu-emacs@gnu.org; Tue, 11 May 2021 08:56:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lgRve-0001Ps-HX for bug-gnu-emacs@gnu.org; Tue, 11 May 2021 08:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 11 May 2021 12:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48137 X-GNU-PR-Package: emacs Original-Received: via spool by 48137-submit@debbugs.gnu.org id=B48137.16207377505417 (code B ref 48137); Tue, 11 May 2021 12:56:02 +0000 Original-Received: (at 48137) by debbugs.gnu.org; 11 May 2021 12:55:50 +0000 Original-Received: from localhost ([127.0.0.1]:35316 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lgRvS-0001PH-3i for submit@debbugs.gnu.org; Tue, 11 May 2021 08:55:50 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:39306) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lgRvC-0001OW-6j for 48137@debbugs.gnu.org; Tue, 11 May 2021 08:55:49 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:48088) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lgRv6-0005Y4-DS; Tue, 11 May 2021 08:55:28 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1590 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lgRv5-0005P6-PE; Tue, 11 May 2021 08:55:28 -0400 In-Reply-To: (message from Ioannis Kappas on Tue, 11 May 2021 07:52:02 +0100) 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:206232 Archived-At: > From: Ioannis Kappas > Date: Tue, 11 May 2021 07:52:02 +0100 > Cc: Stefan Monnier , 48137@debbugs.gnu.org > > > So you are saying the description of the package needs to be decoded > > before using it for list-packages? That'd be okay; all I care about > > is that the decoded stuff does NOT replace the original raw bytes, but > > instead is used only where decoding is needed. IOW, decoding should > > either be done on substrings of the original file, and the result > > stored in strings, or the decoded stuff should be placed in a separate > > scratch buffer, which will be used only where decoding is really > > needed. > > Is loading with `insert-file-contents' and saving as 'raw-text the > same as copying the raw bytes of the original file? No. You should load with insert-file-contents-literally, and then saving will automatically DTRT. You could also load using raw-text, in which case Emacs will be able to convert EOL. But I don't recommend to do any conversions, including the EOL conversions, because they still can change the contents on saving in some rare cases. > `hexlify-buffer' in 'hexl uses 'raw-text to display the raw bytes of > an encoded buffer. I always assumed hexl displayed the actual binary > representation of the underlying file. It does, indeed. > In which case, having `package-install-file' load the .el package file > metaphorically and modifying `package-unpack' to store 'single files > with 'raw-text should satisfy the requirement? Thus header parsing is > done in the intended coding system, while the end package is a "copy" > of the original. Sorry, you lost me here: I don't think I understand the details of how you intend to do the above. > - (package--write-file-no-coding el-file))) > + (package--write-file-raw-text el-file))) You don't need to force any encoding on write: Emacs by default will use the same encoding as the one used to read the file. > Btw, > https://www.gnu.org/software/emacs/manual/html_node/elisp/Coding-System-Basics.html > mentions about the 'no-conversion coding system: > > no-conversion (and its alias binary) is equivalent to raw-text-unix: > it specifies no conversion of either character codes or end-of-line. > > but since it is -unix, it does do EOL conversions to LF. No, -unix means it doesn't convert EOL. IOW, the -unix part means "assume Unix-style LF-only EOLs and don't convert EOL conventions".