Subject: bug#21319: closed (Re: bug#20309: 25.0.50; Coding conversion error during clojure-mode package upgrade)

From: [email-masked] (GNU bug Tracking System)
Date: Tue, 22 Oct 2019 13:04:06 +0000

Your bug report

#20309: `package-install-file' fails with CRLF (Windows) line endings

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
20309: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20309
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#20309: 25.0.50; Coding conversion error during clojure-mode package upgrade
From: Dmitry Gutov <[email-masked]>
To: Stefan Kangas <[email-masked]>
Cc: [email-masked]
Date: Tue, 22 Oct 2019 16:03:12 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

On 22.10.2019 3:57, Stefan Kangas wrote:
> I can't reproduce this on current master.  I believe that it has been
> fixed by the following commit (if not before)

Thank you for the reminder.

I haven't seen this lately, so: closing.

Subject: `package-install-file' fails with CRLF (Windows) line endings
From: steckerhalter <[email-masked]>
To: [email-masked]
Date: Sat, 22 Aug 2015 06:30:30 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

package.el contains this code:

(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).

What we did now is to replace `insert-file-contents-literally' with
`insert-file-contents' dynamically for non-tar files and that seems to
work, although I'm not sure if that's a good solution since I don't
know if there might be side-effects somewhere that can cause other
problems.

The other solution I can think of might be to adapt the regexp in
`package-buffer-info` so that in can deal with CRLF.

cheers,
steckerhalter