From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#48137: 27.2; `package-install-file' fails when loading a package file with DOS line endings Date: Sat, 01 May 2021 09:51:03 -0400 Message-ID: References: <834kfmabvs.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16683"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Ioannis Kappas , 48137@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 01 15:52:10 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 1lcq2U-0004FB-4u for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 May 2021 15:52:10 +0200 Original-Received: from localhost ([::1]:35782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcq2S-0003kw-SL for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 May 2021 09:52:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37926) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcq2M-0003ko-Q5 for bug-gnu-emacs@gnu.org; Sat, 01 May 2021 09:52:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53107) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lcq2M-000366-Ii for bug-gnu-emacs@gnu.org; Sat, 01 May 2021 09:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lcq2M-0005mT-Gm for bug-gnu-emacs@gnu.org; Sat, 01 May 2021 09:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 May 2021 13:52: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.161987707722199 (code B ref 48137); Sat, 01 May 2021 13:52:02 +0000 Original-Received: (at 48137) by debbugs.gnu.org; 1 May 2021 13:51:17 +0000 Original-Received: from localhost ([127.0.0.1]:36420 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcq1c-0005lz-Mu for submit@debbugs.gnu.org; Sat, 01 May 2021 09:51:16 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:10764) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcq1b-0005lr-Uw for 48137@debbugs.gnu.org; Sat, 01 May 2021 09:51:16 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 5829F808A3; Sat, 1 May 2021 09:51:10 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 831C2801AB; Sat, 1 May 2021 09:51:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1619877064; bh=RxMiAwYnAydaM+fKnopbz23DUYwo9iCA8bVf5uJ3VLA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=UdpGiSk4dZy/HTVwLrhZGGUqBCkQRMBSTBLHf1lI7Ux2zXDcqVauOS76kvym+isxY QJ/QMpNg74jjFO5gQ50ImQEY0Lk9LH/j3/uDRb4Ab5axAXad3ODGTayJMOugWIcGb/ MD5JruWjhtohu+QehqLGRh4U7zNKFrMHNeSUmpar82SIkq0ymMbScQkFTx40zxptWD 7NwDje4IWnUArviZuverYMyhDvnwnaMdYAWFjHdXgcoCCmU6fvSUh/n2VIVJg56znr QhOt6VIrYyZsdaEJ3pn1l/Ed+z6oh5fn4gkl41oI42xsnQO3Pfm5dAdiuGTWY5enbe Pt99vQ0UCtfMg== Original-Received: from alfajor (unknown [108.161.125.61]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 51F2612027F; Sat, 1 May 2021 09:51:04 -0400 (EDT) In-Reply-To: <834kfmabvs.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 01 May 2021 15:15:19 +0300") 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:205345 Archived-At: >> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el >> index ecb2573cab..98d63f1aff 100644 >> --- a/lisp/emacs-lisp/package.el >> +++ b/lisp/emacs-lisp/package.el >> @@ -2147,8 +2147,11 @@ package-install-file >> (progn >> (setq default-directory file) >> (dired-mode)) >> - (insert-file-contents-literally file) >> - (when (string-match "\\.tar\\'" file) (tar-mode))) >> + (if (string-match "\\.tar\\'" file) >> + (progn >> + (insert-file-contents-literally file) >> + (tar-mode)) >> + (insert-file-contents file))) > > I don't think this is TRT, because insert-file-contents also decodes > the character encoding, not just the EOL encoding. I think for `.el` files it's actually correct to decode the character encoding here (it's maybe not necessary, but I think it's at least as correct as what we do now, since `package-install-from-buffer` expects a "normal" buffer, hence for `.el` buffers it expects one where characters have been decoded). BTW, this code needs some love, for example to handle `.tar.lz` files. >> Or is it perhaps that packages should only be written with Unix line >> endings and thus the solution is to update documentation and create >> more targeted error messages? > This is probably the best, IMO. Stefan? It sounds like a good idea as well, yes. Stefan