Don't try to add nil packages on refresh

* lisp/emacs-lisp/package.el (package-read-archive-contents): Don't
try to add nil entries.  Warn instead.  (Bug#28502)
* test/lisp/emacs-lisp/package-tests.el
(package-test-update-archives/ignore-nil-entry): New test.
* test/lisp/emacs-lisp/package-resources/with-nil-entry/archive-contents:
New file.
This commit is contained in:
Stefan Kangas 2019-10-20 23:49:18 +02:00
parent 78cb3791fa
commit 0e6f4628d8
3 changed files with 22 additions and 1 deletions

View file

@ -1520,7 +1520,10 @@ If the archive version is too new, signal an error."
(contents (package--read-archive-file contents-file)))
(when contents
(dolist (package contents)
(package--add-to-archive-contents package archive)))))
(if package
(package--add-to-archive-contents package archive)
(lwarn '(package refresh) :warning
"Ignoring `nil' package on `%s' package archive" archive))))))
(defvar package--old-archive-priorities nil
"Store currently used `package-archive-priorities'.