GNU bug report logs -
#48137
27.2; `package-install-file' fails when loading a package file with DOS line endings
Previous Next
Reported by: Ioannis Kappas <ioannis.kappas <at> gmail.com>
Date: Sat, 1 May 2021 11:40:02 UTC
Severity: normal
Tags: patch
Found in version 27.2
Fixed in version 28.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
>> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
>> index ecb2573cab..98d63f1aff 100644
>> --- a/lisp/emacs-lisp/package.el
>> +++ b/lisp/emacs-lisp/package.el
>> @@ -2147,8 +2147,11 @@ package-install-file
>> (progn
>> (setq default-directory file)
>> (dired-mode))
>> - (insert-file-contents-literally file)
>> - (when (string-match "\\.tar\\'" file) (tar-mode)))
>> + (if (string-match "\\.tar\\'" file)
>> + (progn
>> + (insert-file-contents-literally file)
>> + (tar-mode))
>> + (insert-file-contents file)))
>
> I don't think this is TRT, because insert-file-contents also decodes
> the character encoding, not just the EOL encoding.
I think for `.el` files it's actually correct to decode the character
encoding here (it's maybe not necessary, but I think it's at least
as correct as what we do now, since `package-install-from-buffer`
expects a "normal" buffer, hence for `.el` buffers it expects one where
characters have been decoded).
BTW, this code needs some love, for example to handle `.tar.lz` files.
>> Or is it perhaps that packages should only be written with Unix line
>> endings and thus the solution is to update documentation and create
>> more targeted error messages?
> This is probably the best, IMO. Stefan?
It sounds like a good idea as well, yes.
Stefan
This bug report was last modified 3 years and 364 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.