bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#48137: 27.2; `package-install-file' fails when loading a package fil


From: Stefan Monnier
Subject: bug#48137: 27.2; `package-install-file' fails when loading a package file with DOS line endings
Date: Sat, 01 May 2021 09:51:03 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> 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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]