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: Eli Zaretskii
Subject: bug#48137: 27.2; `package-install-file' fails when loading a package file with DOS line endings
Date: Mon, 03 May 2021 21:52:38 +0300

> From: Ioannis Kappas <ioannis.kappas@gmail.com>
> Date: Mon, 3 May 2021 19:49:27 +0100
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>, 48137@debbugs.gnu.org
> 
> > I think it's wrong for package.el to try to decode these files.  It
> > should deliver the files to the disk exactly as they are received
> > through the wire.  And the only safe way of doing that is to treat
> > these files as raw bytes.  Where we must interpret some parts of the
> > files, we should take precautions to handle the complications related
> > to the encoding, but we should not try to decode anything.
> 
> Thanks, I think there is agreement we shouldn't decode files coming
> from a remote archive. Are there still concerns though with decoding
> local .el files passed in to `package-install-file' supporting the
> windows DOS EOL case Eli?

Yes, I think we shouldn't decode _any_ files, not even the *.el
files.  That includes their EOL convention.  Therefore, this:

> If not, I would like to suggest a slightly
> updated patch that is targeting .el files directly as an exemption:
> 
> diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
> index ecb2573cab..19ab0445b9 100644
> --- a/lisp/emacs-lisp/package.el
> +++ b/lisp/emacs-lisp/package.el
> @@ -2147,7 +2147,9 @@ package-install-file
>          (progn
>            (setq default-directory file)
>            (dired-mode))
> -      (insert-file-contents-literally file)
> +      (if (string-match "\\.el\\'" file)
> +          (insert-file-contents file)
> +        (insert-file-contents-literally file))
>        (when (string-match "\\.tar\\'" file) (tar-mode)))
>      (package-install-from-buffer)))

is not something I can endorse, especially as it decodes much more
than just the EOL format.





reply via email to

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