From: Tao Fang <fangtao0901@gmail.com>
To: 22311@debbugs.gnu.org
Subject: bug#22311: 25.1.50; package.el misused (read-from-string) will potentially cause "elpa/archives/xxx/archive-contents" file malformed
Date: Tue, 05 Jan 2016 23:33:45 +0800 [thread overview]
Message-ID: <87oad0ca7a.fsf@gmail.com> (raw)
Hi, all
There is a misused function read-from-string in package.el L1485:
1472 (defun package--download-one-archive (archive file &optional async)
1473 "Retrieve an archive file FILE from ARCHIVE, and cache it.
1474 ARCHIVE should be a cons cell of the form (NAME . LOCATION),
1475 similar to an entry in `package-alist'. Save the cached copy to
1476 \"archives/NAME/FILE\" in `package-user-dir'."
1477 (package--with-response-buffer (cdr archive) :file file
1478 :async async
1479 :error-form (package--update-downloads-in-progress archive)
1480 (let* ((location (cdr archive))
1481 (name (car archive))
1482 (content (buffer-string))
1483 (dir (expand-file-name (format "archives/%s" name) package-user-dir))
1484 (local-file (expand-file-name file dir)))
1485 (when (listp (read-from-string content))
1486 (make-directory dir t)
1487 (if (or (not package-check-signature)
listp checks return value of (read-from-string content) to make sure we
get file content with correct format, but as its doc says:
"
(read-from-string STRING &optional START END)
Read one Lisp expression which is represented as text by STRING.
Returns a cons: (OBJECT-READ . FINAL-STRING-INDEX).
"
(listp (read-from-string content)) will always return t, if archive-contents file download
finished with malformed content (e.g. error message return from proxy
server), it will be parsed and saved by mistake.
Simply replace (read-from-string) with (read) would resolve this, I think.
next reply other threads:[~2016-01-05 15:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-05 15:33 Tao Fang [this message]
2018-06-16 23:07 ` bug#22311: 25.1.50; package.el misused (read-from-string) will potentially cause "elpa/archives/xxx/archive-contents" file malformed Noam Postavsky
2018-06-26 23:57 ` Noam Postavsky
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=87oad0ca7a.fsf@gmail.com \
--to=fangtao0901@gmail.com \
--cc=22311@debbugs.gnu.org \
/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.