all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Stefan Kangas <stefan@marxist.se>
Cc: emacs@postmomentum.ch, 21319@debbugs.gnu.org
Subject: bug#21319: `package-install-file' fails with CRLF (Windows) line endings
Date: Fri, 29 Nov 2019 15:29:55 +0200	[thread overview]
Message-ID: <835zj2q08c.fsf@gnu.org> (raw)
In-Reply-To: <878snykffc.fsf@marxist.se> (message from Stefan Kangas on Fri, 29 Nov 2019 13:58:15 +0100)

> From: Stefan Kangas <stefan@marxist.se>
> 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.





  reply	other threads:[~2019-11-29 13:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-12 13:46 bug#20309: 25.0.50; Coding conversion error during clojure-mode package upgrade Dmitry Gutov
2019-10-22  0:57 ` Stefan Kangas
2019-10-22 13:03   ` Dmitry Gutov
2019-10-22  1:04 ` bug#20309: bug#21319: `package-install-file' fails with CRLF (Windows) line endings Stefan Kangas
2019-10-22 14:50   ` Stefan Kangas
2019-11-29 12:58   ` Stefan Kangas
2019-11-29 13:29     ` Eli Zaretskii [this message]
2022-01-29 17:03       ` Lars Ingebrigtsen
2022-01-29 17:07         ` Eli Zaretskii
2022-01-29 17:09           ` Lars Ingebrigtsen
  -- strict thread matches above, loose matches on Subject: below --
2015-08-22  4:30 steckerhalter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=835zj2q08c.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=21319@debbugs.gnu.org \
    --cc=emacs@postmomentum.ch \
    --cc=stefan@marxist.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.