unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: ioannis.kappas@gmail.com, 48137@debbugs.gnu.org
Subject: bug#48137: 27.2; `package-install-file' fails when loading a package file with DOS line endings
Date: Tue, 04 May 2021 11:57:53 -0400	[thread overview]
Message-ID: <jwv4kfio6a8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83lf8u68bu.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 04 May 2021 14:34:45 +0300")

>> > 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.
>> I'm not sure what you're referring to here.
> To the suggestion to decode *.el files by package.el as part of the
> installation.

Even for `package-install-file`?
[ which is a completely different code path than `package-install`.
  It's a kind of "side feature" to install packages
  using `package.el` without using an ELPArchive.  ]

>> In the OP's case, i.e. `package-install-file` (which is a seldom used
>> functionality, not part of the "normal" `package-install`) the file doesn't go
>> through the wire: it's already "local" and we currently implement this
>> code on top of `package-install-from-buffer`, so it has to work
>> correctly with an already-decoded buffer.
> If this works with buffer text, then how are DOS EOLs come into play
> here?  There are no CRLF pairs in decoded buffer text.

`package-install-file` takes a file, not a buffer, as input.
But internally it works by calling `package-install-from-buffer`.

Taking a step back, I think I'm just failing to understand why you
insist on not decoding the `.el` file.

What `package-install-file` will do is extract `<foo>-pkg.el` from it,
save a copy of the file somehow to `~/.emacs.d/elpa/<foo>/<foo>.el` and
then compile it.  After that, the file (neither the original file, nor
its copy in `~/.emacs.d/elpa/<foo>/<foo>.el`) will basically never be
used any more.  So the only "significant" uses of this file are
extraction of data for `<foo>-pkg.el` and byte-compilation, both of
which work on the decoded version of the file.

Furthermore, `insert-file-contents + write-region` should(!) preserve
the bytes in all normal cases.

I agree that in principle it would be better to copy the file by copying
its bytes than by `insert-file-contents + write-region`.

[ BTW, we have a bug in `package-install-from-buffer` currently for
  buffers which contain non-ASCII chars (because it saves the buffer's
  content via `package-unpack` => `package--write-file-no-coding`), so
  if we do go ahead with the change Ioannis proposes (which I think is
  acceptable) we definitely need to fix that bug in
  `package-install-from-buffer`.  ]


        Stefan






  reply	other threads:[~2021-05-04 15:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-01 11:38 bug#48137: 27.2; `package-install-file' fails when loading a package file with DOS line endings Ioannis Kappas
2021-05-01 11:48 ` Ioannis Kappas
2021-05-01 12:15   ` Eli Zaretskii
2021-05-01 13:51     ` Stefan Monnier
2021-05-03 17:47       ` Ioannis Kappas
2021-05-03 18:23         ` Stefan Monnier
2021-05-03 18:33           ` Eli Zaretskii
2021-05-03 18:49             ` Ioannis Kappas
2021-05-03 18:52               ` Eli Zaretskii
2021-05-03 20:12                 ` Stefan Monnier
2021-05-04 11:39                   ` Eli Zaretskii
2021-05-03 19:41             ` Stefan Monnier
2021-05-04 11:34               ` Eli Zaretskii
2021-05-04 15:57                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-05-04 16:14                   ` Eli Zaretskii
2021-05-04 16:27                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-04 16:51                       ` Eli Zaretskii
2021-05-05  7:03                         ` Ioannis Kappas
2021-05-05 12:01                           ` Eli Zaretskii
     [not found]                             ` <CAMRHuGAi9+q-MKRGPxLqxdP_7SSF4Nqj+JuSsZigviAQs_d7Rw@mail.gmail.com>
2021-05-06  6:55                               ` Ioannis Kappas
2021-05-06  8:12                                 ` Eli Zaretskii
2021-05-06 13:27                                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-06 15:26                                   ` Eli Zaretskii
2021-05-11  6:52                                     ` Ioannis Kappas
2021-05-11 12:55                                       ` Eli Zaretskii
2021-05-15 13:52                                         ` Ioannis Kappas
2021-05-16  9:09                                           ` Ioannis Kappas
2021-05-29  8:20                                             ` Eli Zaretskii
2021-05-29 13:59                                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-29 14:09                                                 ` Eli Zaretskii
2021-06-06  9:11                                                   ` Ioannis Kappas
2021-07-20 13:54                                                     ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwv4kfio6a8.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=48137@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=ioannis.kappas@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).