From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ioannis Kappas Newsgroups: gmane.emacs.bugs Subject: bug#48137: 27.2; `package-install-file' fails when loading a package file with DOS line endings Date: Mon, 3 May 2021 19:49:27 +0100 Message-ID: References: <834kfmabvs.fsf@gnu.org> <83tunj651i.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33314"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 48137@debbugs.gnu.org, Stefan Monnier To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 03 20:52:09 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lddfs-0008Xs-IX for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 03 May 2021 20:52:08 +0200 Original-Received: from localhost ([::1]:37640 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lddfr-0007r0-Ko for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 03 May 2021 14:52:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldddr-0005c0-B9 for bug-gnu-emacs@gnu.org; Mon, 03 May 2021 14:50:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36556) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldddq-0006jn-KG for bug-gnu-emacs@gnu.org; Mon, 03 May 2021 14:50:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ldddq-0003zD-HD for bug-gnu-emacs@gnu.org; Mon, 03 May 2021 14:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ioannis Kappas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 03 May 2021 18:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48137 X-GNU-PR-Package: emacs Original-Received: via spool by 48137-submit@debbugs.gnu.org id=B48137.162006779915313 (code B ref 48137); Mon, 03 May 2021 18:50:02 +0000 Original-Received: (at 48137) by debbugs.gnu.org; 3 May 2021 18:49:59 +0000 Original-Received: from localhost ([127.0.0.1]:48102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ldddm-0003yv-Rp for submit@debbugs.gnu.org; Mon, 03 May 2021 14:49:59 -0400 Original-Received: from mail-oi1-f170.google.com ([209.85.167.170]:36787) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ldddW-0003yl-Is for 48137@debbugs.gnu.org; Mon, 03 May 2021 14:49:57 -0400 Original-Received: by mail-oi1-f170.google.com with SMTP id i26so6364878oii.3 for <48137@debbugs.gnu.org>; Mon, 03 May 2021 11:49:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=O/haL5FxmLaBqUVhXMiNooZ2O5T2W5hv9mOM6qU/bXc=; b=KgkdYI6ox/s1juxSuBUsEVN/gWeDX2Yl3SHsG9BQl80S7jVfGx+KS22VZCl1IV8DW/ lRVS+DuoJM3XQKB5P5Iz0ZvH3fizW6SKIgqDsiLjd2t689f3s2BezXfp4YirXOFrdiCx xA/lRAQWJENeFfJ5jiI5cWNfWe+bHz3jUTRV3be6VzEy+pxS8Cs6LLgo4IJ+45WlOHQC 7kZjztuKohpqkRQ1EZkI3wqbI2pkjPCbKdiv9ifttOHBFj7dupyXNUBGxUIfYNZcRJ/k 10T3kM6yA/Nl+qWl/CC4FMYG0mxJQ1t+/B8A+B4Rq9HPoqmsefSzLgmIrzfzBP4dbDDg hNOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=O/haL5FxmLaBqUVhXMiNooZ2O5T2W5hv9mOM6qU/bXc=; b=K4wOmj9vjKs1UHVdeJQBxUSQyD+cmTlEYVxKIeksiOjrHh7YWOgi7bTOQO1tBtXyX/ c7zXBsKLbbQrhmlP7gAyfUpNpbMf9IDLIIOTV75euZpYCIqeQPgjAntLn9duiGH4QOPG OOTE7JuBaP+FKGIDakJ+VnPWRgiLIpoVO3q9DJMbcuQwSokACZgIzpYFHeLiGfTM2ryk 5OUfpUm8+pgN81yV6u1Dd2ZL/Oy4IaduBUuuZKGCZKrDVb0Cq03z+dVRvngTexHUfWG7 LcDk9asPrJNzK4sw6Bh/4U2BSRMqHdOVCX7m0JOl44U9Kne5/rFgPyNd9YNANr9DT+WQ HPTA== X-Gm-Message-State: AOAM531TVAYmrfyC0OK8hVw696z9W84m05JCSZ+kVnsJWkG8Nm7fUOJL atnBzdtd5rMt8F2ECvgtiUHv5eTfveLMiuWXjzE= X-Google-Smtp-Source: ABdhPJxyogsPXlmGSWRRJvqi+ypO2OMvnzxRT55xXd6vaXosKOC+9ZC4Vf66g41d/e6UFhDO0VWdtY35jhuhb2KwnMQ= X-Received: by 2002:aca:39d7:: with SMTP id g206mr18029592oia.122.1620067776859; Mon, 03 May 2021 11:49:36 -0700 (PDT) In-Reply-To: <83tunj651i.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:205555 Archived-At: On Mon, May 3, 2021 at 7:33 PM Eli Zaretskii wrote: > > > From: Stefan Monnier > > Cc: Eli Zaretskii , 48137@debbugs.gnu.org > > Date: Mon, 03 May 2021 14:23:53 -0400 > > > > > Thanks Stefan. Does this also apply to the only other use of > > > `insert-file-contents-literally' in 'package,? > > > > I don't think so, no. > > > > > In particular `package--with-response-buffer-1' is referenced by > > > `package-check-signature' > > > > This definitely needs to deal with bytes only, we don't want any > > encoding/decoding to risk changing the byte contents. > > > > > and `package--download-one-archive'. > > > > I think the same is true here. > > > > > (I am personally more in favor of supporting DOS files, because it > > > makes the caller's life easier on MS-Windows and brings them on par > > > with Unix, though Eli's concern has to be addressed first) > > > > My own opinion is that .el files are files that belong to Emacs and they > > should use Emacs's "native" file format, whatever that is. I think the > > "most native" would be `utf-8-emacs-unix` so I'd be OK with deprecating > > all other encodings, but I don't think that's going to happen ;-) > > 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? 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)))