all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ivan Shmakov <ivan@siamics.net>
To: 20231@debbugs.gnu.org, Steve Purcell <steve@sanityinc.com>
Subject: bug#20231: 25.0.50; package.el mangles non-ascii content in downloaded archive-contents data
Date: Sat, 11 Apr 2015 18:07:13 +0000	[thread overview]
Message-ID: <878udysfn2.fsf@violet.siamics.net> (raw)
In-Reply-To: <8292DA72-0898-47B2-A1C1-F7D94A52A437@sanityinc.com> (Steve Purcell's message of "Sat, 11 Apr 2015 18:08:16 +0100")

>>>>> Steve Purcell <steve@sanityinc.com> writes:

 > --- a/lisp/emacs-lisp/package.el
 > +++ b/lisp/emacs-lisp/package.el
 > @@ -1279,12 +1279,13 @@ defun package--read-archive-file (file)
 >    (let ((filename (expand-file-name file package-user-dir)))
 >      (when (file-exists-p filename)
 >        (with-temp-buffer
 > -        (insert-file-contents-literally filename)
 > -        (let ((contents (read (current-buffer))))
 > -          (if (> (car contents) package-archive-version)
 > -              (error "Package archive version %d is higher than %d"
 > -                (car contents) package-archive-version))
 > -          (cdr contents))))))
 > +        (let ((coding-system-for-read 'utf-8))
 > +          (insert-file-contents filename)

	As insert-file-contents may imply a whole lot of additional
	processing beyond decoding UTF-8, I’d rather use an explicit
	decode-coding-region here, like (untested):

       (with-temp-buffer
         (insert-file-contents-literally filename)
+        (decode-coding-region (point-min) (point-max) 'utf-8)
         (let ((contents (read (current-buffer))))
           …))

 > +          (let ((contents (read (current-buffer))))
 > +            (if (> (car contents) package-archive-version)
 > +                (error "Package archive version %d is higher than %d"
 > +                       (car contents) package-archive-version))
 > +            (cdr contents)))))))
 > 
 >  (defun package-read-archive-contents (archive)
 >    "Re-read archive contents for ARCHIVE.

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A





  parent reply	other threads:[~2015-04-11 18:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-30 16:21 bug#20231: 25.0.50; package.el mangles non-ascii content in downloaded archive-contents data Steve Purcell
2015-03-30 20:58 ` Stefan Monnier
     [not found]   ` <CD30FDF5-7F20-47B7-9DE8-7DDC1C6BC1B1@sanityinc.com>
     [not found]     ` <jwv619iauly.fsf-monnier+emacsbugs@gnu.org>
     [not found]       ` <6343E9EC-9E23-4D44-9CD1-82C26DB7CDA3@sanityinc.com>
     [not found]         ` <jwv619h8ffv.fsf-monnier+emacsbugs@gnu.org>
2015-04-11 17:08           ` Steve Purcell
2015-04-11 17:41             ` Eli Zaretskii
2015-04-11 18:48               ` Steve Purcell
2015-04-11 18:56                 ` Eli Zaretskii
2015-04-11 18:07             ` Ivan Shmakov [this message]
2015-04-11 18:35               ` Eli Zaretskii
2015-04-11 19:30                 ` Ivan Shmakov
2015-04-11 19:48                   ` Eli Zaretskii
2015-04-13 12:31                     ` Artur Malabarba
2015-04-13 14:02                       ` Stefan Monnier
2015-04-13 20:45                         ` Steve Purcell
2015-04-19 15:21                           ` Artur Malabarba
2015-04-19 15:23                             ` Steve Purcell
2015-04-19 16:40                               ` Eli Zaretskii
2015-04-19 17:01                               ` Artur Malabarba
     [not found] ` <handler.20231.D20231.14294629225589.notifdone@debbugs.gnu.org>
2015-04-19 17:06   ` bug#20231: closed (Re: bug#20231: 25.0.50; package.el mangles non-ascii content in downloaded archive-contents data) Steve Purcell

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

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

  git send-email \
    --in-reply-to=878udysfn2.fsf@violet.siamics.net \
    --to=ivan@siamics.net \
    --cc=20231@debbugs.gnu.org \
    --cc=steve@sanityinc.com \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.