瀏覽代碼

dpkg: Restore multiple processing checks for packages and archives

The notices about duplicate entries not being processed got suppressed
when the requeueing insertion protection got enabled. Add a new variable
to track when packages or archives have been processed more than once.

Regression introduced in commit ce27f5dc0c3dc6ed7656d09784ea461407765d7d.
Guillem Jover 11 年之前
父節點
當前提交
c4e109999d
共有 5 個文件被更改,包括 19 次插入7 次删除
  1. 2 0
      debian/changelog
  2. 1 0
      src/filesdb.c
  3. 2 0
      src/main.h
  4. 13 6
      src/packages.c
  5. 1 1
      src/unpack.c

+ 2 - 0
debian/changelog

@@ -21,6 +21,8 @@ dpkg (1.17.22) UNRELEASED; urgency=low
     Reported by Dominyk Tiller <dominyktiller@gmail.com>.
   * Normalize tar entry uid and gid from the current system only in dpkg
     unpack. Regression introduced in dpkg 1.17.14. Closes: #769211
+  * Restore multiple processing instances check for packages and archives
+    specified on the command-line. Regression introduced in dpkg 1.17.20.
 
   [ Updated programs translations ]
   * German (Sven Joachim).

+ 1 - 0
src/filesdb.c

@@ -109,6 +109,7 @@ ensure_package_clientdata(struct pkginfo *pkg)
   pkg->clientdata->fileslistvalid = false;
   pkg->clientdata->files = NULL;
   pkg->clientdata->replacingfilesandsaid = 0;
+  pkg->clientdata->cmdline_seen = 0;
   pkg->clientdata->listfile_phys_offs = 0;
   pkg->clientdata->trigprocdeferred = NULL;
 }

+ 2 - 0
src/main.h

@@ -64,6 +64,7 @@ struct perpackagestate {
   bool fileslistvalid;
   struct fileinlist *files;
   int replacingfilesandsaid;
+  int cmdline_seen;
 
   off_t listfile_phys_offs;
 
@@ -193,6 +194,7 @@ int clearselections(const char *const *argv);
 
 void md5hash(struct pkginfo *pkg, char *hashbuf, const char *fn);
 void enqueue_package(struct pkginfo *pkg);
+void enqueue_package_mark_seen(struct pkginfo *pkg);
 void process_queue(void);
 int packages(const char *const *argv);
 void removal_bulk(struct pkginfo *pkg);

+ 13 - 6
src/packages.c

@@ -63,6 +63,13 @@ enqueue_package(struct pkginfo *pkg)
   pkg_queue_push(&queue, pkg);
 }
 
+void
+enqueue_package_mark_seen(struct pkginfo *pkg)
+{
+  enqueue_package(pkg);
+  pkg->clientdata->cmdline_seen++;
+}
+
 static void
 enqueue_pending(void)
 {
@@ -119,7 +126,7 @@ enqueue_specified(const char *const *argv)
       badusage(_("you must specify packages by their own names, "
                  "not by quoting the names of the files they come in"));
     }
-    enqueue_package(pkg);
+    enqueue_package_mark_seen(pkg);
   }
 }
 
@@ -185,8 +192,10 @@ void process_queue(void) {
   }
   for (rundown = queue.head; rundown; rundown = rundown->next) {
     ensure_package_clientdata(rundown->pkg);
-    if (rundown->pkg->clientdata->istobe == istobe) {
-      /* Erase the queue entry - this is a second copy! */
+
+    /* We have processed this package more than once. There are no duplicates
+     * as we make sure of that when enqueuing them. */
+    if (rundown->pkg->clientdata->cmdline_seen > 1) {
       switch (cipaction->arg_int) {
       case act_triggers:
       case act_configure: case act_remove: case act_purge:
@@ -201,10 +210,8 @@ void process_queue(void) {
       default:
         internerr("unknown action '%d'", cipaction->arg_int);
       }
-      rundown->pkg = NULL;
-   } else {
-      rundown->pkg->clientdata->istobe= istobe;
     }
+    rundown->pkg->clientdata->istobe = istobe;
   }
 
   while (!pkg_queue_is_empty(&queue)) {

+ 1 - 1
src/unpack.c

@@ -1480,5 +1480,5 @@ void process_archive(const char *filename) {
   }
 
   if (cipaction->arg_int == act_install)
-    enqueue_package(pkg);
+    enqueue_package_mark_seen(pkg);
 }