GNU bug report logs -
#21319
`package-install-file' fails with CRLF (Windows) line endings
Previous Next
Reported by: steckerhalter <emacs <at> postmomentum.ch>
Date: Sat, 22 Aug 2015 05:39:02 UTC
Severity: minor
Tags: moreinfo
Found in version 25.0.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> From: Stefan Kangas <stefan <at> marxist.se>
> Date: Fri, 29 Nov 2019 13:58:15 +0100
> Cc: 21319 <at> 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.
This bug report was last modified 3 years and 114 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.