Subject: 24.3.50; Endless loop in "package-read-all-archive-contents"

From: Sebastian Wiesner <[email-masked]>
Date: Tue, 25 Jun 2013 22:19:43 +0200

If a package is contained in two or more archives,
"package-read-all-archive-contents" hangs in an endless loop.  For
instance, in "emacs -Q":

ELISP> package-archives
(("gnu" . "http://elpa.gnu.org/packages/"))

ELISP> (package-refresh-contents)
nil
ELISP> (add-to-list 'package-archives
  '("melpa" . "http://melpa.milkbox.net/packages/") t)
(("gnu" . "http://elpa.gnu.org/packages/")
 ("melpa" . "http://melpa.milkbox.net/packages/"))

ELISP> package-archives
(("gnu" . "http://elpa.gnu.org/packages/")
 ("melpa" . "http://melpa.milkbox.net/packages/"))

ELISP> (package-refresh-contents)
*** Eval error ***  Quit during evaluation

The last invocation continues forever.  "Quit during evaluation" is the
result of repeatedly pressing "C-g".

I inserted some "message" calls into functions called by
"package-refresh-contents", which indicate that the "while" loop at the
bottom of "package--add-to-archive-contents" is the root cause.  This
loop seems to continue forever if "package--add-to-archive-contents" is
invoked with a "package" which is already contained in another archive.

Inserting a "(message "DEBUG: Looping for %s" package)" at the beginning
of the body of this loop repeats this message a few thousand times
before C-g succeeds in interrupting the evaluation.  In my case, this
was the "yasnippet" package which is contained in GNU as well as in
MELPA.

Apparently the test of this loop is wrong, but since I do not understand
what the loop is supposed to do, I can't say how it is wrong.