summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog3
-rw-r--r--src/filesdb.c1
-rw-r--r--src/main.h2
-rw-r--r--src/packages.c7
4 files changed, 13 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 9d9411762..149f4daa1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,5 +1,8 @@
dpkg (1.17.20) UNRELEASED; urgency=low
+ [ Guillem Jover ]
+ * Add a requeueing insertion protection for process_queue().
+
[ Updated programs translations ]
* German (Sven Joachim).
* Simplified Chinese (Zhou Mo).
diff --git a/src/filesdb.c b/src/filesdb.c
index fc8dd55fc..59d93e14c 100644
--- a/src/filesdb.c
+++ b/src/filesdb.c
@@ -105,6 +105,7 @@ ensure_package_clientdata(struct pkginfo *pkg)
pkg->clientdata = nfmalloc(sizeof(struct perpackagestate));
pkg->clientdata->istobe = PKG_ISTOBE_NORMAL;
pkg->clientdata->color = PKG_CYCLE_WHITE;
+ pkg->clientdata->enqueued = false;
pkg->clientdata->fileslistvalid = false;
pkg->clientdata->files = NULL;
pkg->clientdata->replacingfilesandsaid = 0;
diff --git a/src/main.h b/src/main.h
index 57854277f..eafea872f 100644
--- a/src/main.h
+++ b/src/main.h
@@ -50,6 +50,8 @@ struct perpackagestate {
/** Used during cycle detection. */
enum pkg_cycle_color color;
+ bool enqueued;
+
/**
* filelistvalid files Meaning
* ------------- ----- -------
diff --git a/src/packages.c b/src/packages.c
index 5a14599ef..29517c7ed 100644
--- a/src/packages.c
+++ b/src/packages.c
@@ -56,6 +56,10 @@ int sincenothing = 0, dependtry = 0;
void
enqueue_package(struct pkginfo *pkg)
{
+ ensure_package_clientdata(pkg);
+ if (pkg->clientdata->enqueued)
+ return;
+ pkg->clientdata->enqueued = true;
pkg_queue_push(&queue, pkg);
}
@@ -208,6 +212,9 @@ void process_queue(void) {
if (!pkg)
continue; /* Duplicate, which we removed earlier. */
+ ensure_package_clientdata(pkg);
+ pkg->clientdata->enqueued = false;
+
action_todo = cipaction->arg_int;
if (sincenothing++ > queue.length * 2 + 2) {