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, 04 May 2021 19:14:20 +0300 Message-ID: <83mtta4gtf.fsf@gnu.org> References: <834kfmabvs.fsf@gnu.org> <83tunj651i.fsf@gnu.org> <83lf8u68bu.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19059"; mail-complaints-to="usenet@ciao.gmane.io" Cc: ioannis.kappas@gmail.com, 48137@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 04 18:21:35 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 1ldxnh-0004pf-TK for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 May 2021 18:21:33 +0200 Original-Received: from localhost ([::1]:34636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldxnh-0002kO-02 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 May 2021 12:21:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57264) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldxhP-0006ko-7t for bug-gnu-emacs@gnu.org; Tue, 04 May 2021 12:15:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42523) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldxhO-00064x-Vr for bug-gnu-emacs@gnu.org; Tue, 04 May 2021 12:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ldxhO-00034e-QU for bug-gnu-emacs@gnu.org; Tue, 04 May 2021 12:15: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, 04 May 2021 16:15: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.162014489111793 (code B ref 48137); Tue, 04 May 2021 16:15:02 +0000 Original-Received: (at 48137) by debbugs.gnu.org; 4 May 2021 16:14:51 +0000 Original-Received: from localhost ([127.0.0.1]:54068 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ldxh9-000348-CF for submit@debbugs.gnu.org; Tue, 04 May 2021 12:14:51 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:48862) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ldxh4-000342-OG for 48137@debbugs.gnu.org; Tue, 04 May 2021 12:14:46 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55094) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldxgz-0005rM-6q; Tue, 04 May 2021 12:14:37 -0400 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1043 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ldxgx-0001ML-4z; Tue, 04 May 2021 12:14:36 -0400 In-Reply-To: (message from Stefan Monnier on Tue, 04 May 2021 11:57:53 -0400) 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:205628 Archived-At: > From: Stefan Monnier > Cc: ioannis.kappas@gmail.com, 48137@debbugs.gnu.org > Date: Tue, 04 May 2021 11:57:53 -0400 > > >> I'm not sure what you're referring to here. > > To the suggestion to decode *.el files by package.el as part of the > > installation. > > Even for `package-install-file`? Yes, why not? How else can we ensure 100% that the installed file will be identical to the original one? > > If this works with buffer text, then how are DOS EOLs come into play > > here? There are no CRLF pairs in decoded buffer text. > > `package-install-file` takes a file, not a buffer, as input. > But internally it works by calling `package-install-from-buffer`. Then at some point we do insert the file into a buffer. I'm saying that we should insert it literally. > What `package-install-file` will do is extract `-pkg.el` from it, ^^^^^^^ What is "it" in "from it" there? > save a copy of the file somehow to `~/.emacs.d/elpa//.el` and > then compile it. After that, the file (neither the original file, nor > its copy in `~/.emacs.d/elpa//.el`) will basically never be > used any more. So the only "significant" uses of this file are > extraction of data for `-pkg.el` and byte-compilation, both of > which work on the decoded version of the file. I'm saying that extraction should not decode it. Byte compilation will do its usual thing, but that's not what I was talking about. > Furthermore, `insert-file-contents + write-region` should(!) preserve > the bytes in all normal cases. Yes, but that's not 100% guaranteed. It can fail. the only way not to fail is not to decode (and then not to encode). > I agree that in principle it would be better to copy the file by copying > its bytes than by `insert-file-contents + write-region`. Why only "in principle"? what prevents us from actually doing that?