all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: steckerhalter <emacs@postmomentum.ch>
To: 21319@debbugs.gnu.org
Subject: bug#21319: `package-install-file' fails with CRLF (Windows) line endings
Date: Sat, 22 Aug 2015 06:30:30 +0200	[thread overview]
Message-ID: <CAJa170owsGSEEOef6=HrhMpeq00EAovO8pK77O2PdEdoGTbk9A@mail.gmail.com> (raw)

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





             reply	other threads:[~2015-08-22  4:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-22  4:30 steckerhalter [this message]
  -- strict thread matches above, loose matches on Subject: below --
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
2022-01-29 17:03       ` Lars Ingebrigtsen
2022-01-29 17:07         ` Eli Zaretskii
2022-01-29 17:09           ` Lars Ingebrigtsen

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='CAJa170owsGSEEOef6=HrhMpeq00EAovO8pK77O2PdEdoGTbk9A@mail.gmail.com' \
    --to=emacs@postmomentum.ch \
    --cc=21319@debbugs.gnu.org \
    /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.