From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#21319: `package-install-file' fails with CRLF (Windows) line endings Date: Fri, 29 Nov 2019 15:29:55 +0200 Message-ID: <835zj2q08c.fsf@gnu.org> References: <878snykffc.fsf@marxist.se> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="44722"; mail-complaints-to="usenet@blaine.gmane.org" Cc: emacs@postmomentum.ch, 21319@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 29 14:39:11 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iagUH-000BUO-I8 for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Nov 2019 14:39:09 +0100 Original-Received: from localhost ([::1]:59180 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iagUG-0003U6-69 for geb-bug-gnu-emacs@m.gmane.org; Fri, 29 Nov 2019 08:39:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60390) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iagLb-00053J-AN for bug-gnu-emacs@gnu.org; Fri, 29 Nov 2019 08:30:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iagLX-0007a9-9m for bug-gnu-emacs@gnu.org; Fri, 29 Nov 2019 08:30:09 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53785) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iagLS-0007UW-4I for bug-gnu-emacs@gnu.org; Fri, 29 Nov 2019 08:30:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iagLS-0006eB-0I for bug-gnu-emacs@gnu.org; Fri, 29 Nov 2019 08:30:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 29 Nov 2019 13:30:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21319 X-GNU-PR-Package: emacs Original-Received: via spool by 21319-submit@debbugs.gnu.org id=B21319.157503419625509 (code B ref 21319); Fri, 29 Nov 2019 13:30:01 +0000 Original-Received: (at 21319) by debbugs.gnu.org; 29 Nov 2019 13:29:56 +0000 Original-Received: from localhost ([127.0.0.1]:59758 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iagLM-0006dM-3X for submit@debbugs.gnu.org; Fri, 29 Nov 2019 08:29:56 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51013) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iagLJ-0006dA-Nc for 21319@debbugs.gnu.org; Fri, 29 Nov 2019 08:29:54 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:44716) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iagLD-0007As-9i; Fri, 29 Nov 2019 08:29:47 -0500 Original-Received: from [176.228.60.248] (port=1101 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iagL8-0000eY-4g; Fri, 29 Nov 2019 08:29:43 -0500 In-reply-to: <878snykffc.fsf@marxist.se> (message from Stefan Kangas on Fri, 29 Nov 2019 13:58:15 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:172649 Archived-At: > From: Stefan Kangas > Date: Fri, 29 Nov 2019 13:58:15 +0100 > Cc: 21319@debbugs.gnu.org > > >> (defun package-install-file (file) > >> "Install a package from a file. > >> The file can either be a tar file or an Emacs Lisp file." > >> (interactive "fPackage file name: ") > >> (with-temp-buffer > >> (insert-file-contents-literally file) > >> (when (string-match "\\.tar\\'" file) (tar-mode)) > >> (package-install-from-buffer))) > >> > >> Since `insert-file-contents-literally' does not do any conversion > >> `package-buffer-info' fails to parse the info if the file is .el and > >> contains CRLF line endings. It then errors out with: > >> > >> Debugger entered--Lisp error: (error "Package lacks a \"Version\" or > >> \"Package-Version\" header") > >> signal(error ("Package lacks a \"Version\" or \"Package-Version\" header")) > >> error("Package lacks a \"Version\" or \"Package-Version\" header") > >> package-buffer-info() > >> > >> This affects all recent Emacs versions (including trunk). > > > > This was reported 4 years ago, but unfortunately never got a reply at > > the time. > > > > Are you still seeing this on a recent version of Emacs? If yes, could > > you please provide a minimal example file which fails to install? The code is still there. One can see if the problem happens by making a package that is a single .el file with CRLF EOL format. > > Also, why does your file have these line endings in the first place? > > Was this file written in Emacs? I'm trying to understand if this is > > an important use case or the common scenario for users of MS-Windows, > > since I don't use it myself. When a file is created on MS-Windows, even if it's a .el file, its EOL format is by default identical to that of the underlying platform's defaults. On MS-Windows, you will get CRLF, yes. > Does anyone think it's important to support CRLF line endings in > package.el? I don't know if this is important, but then fix is trivial: use insert-file-contents after binding coding-system-for-read to raw-text. > I don't use Windows, so I'm not sure that I understand if > this is an important use case or not. But AFAIK, and this might be > completely wrong, you should be fine as long as you edit the file in > Emacs? AFAIU, the problem is that one cannot install such a package, because the current code signals an error.