don't start mucking with filelists for packages which have already been removed!
authorewt <devnull@localhost>
Tue, 13 Apr 1999 22:47:44 +0000 (22:47 +0000)
committerewt <devnull@localhost>
Tue, 13 Apr 1999 22:47:44 +0000 (22:47 +0000)
CVS patchset: 2991
CVS date: 1999/04/13 22:47:44

lib/transaction.c

index 723750e..baffedb 100644 (file)
@@ -358,6 +358,9 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify,
     NOTIFY((NULL, RPMCALLBACK_TRANS_START, 6, flEntries, NULL, notifyData));
 
     for (fi = flList; (fi - flList) < flEntries; fi++) {
+       int k, ro;
+       int knownBad;
+
        NOTIFY((NULL, RPMCALLBACK_TRANS_PROGRESS, (fi - flList), flEntries,
               NULL, notifyData));
 
@@ -369,8 +372,22 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify,
            numShared += matches[i].count;
 
        shared = sharedList = malloc(sizeof(*sharedList) * (numShared + 1));
+       knownBad = 0;
        for (i = 0; i < fi->fc; i++) {
+           /* Take care not to mark files as replaced in packages that will
+              have been removed before we got here. */
            for (j = 0; j < matches[i].count; j++) {
+               ro = matches[i].recs[j].recOffset;
+               if (ro == knownBad) continue;
+               for (k = 0; k < ts->orderCount; k++) {
+                   if (ts->order[k].type == TR_REMOVED &&
+                       ts->order[k].u.removed.dboffset == ro) break;
+               }
+               if (k < ts->orderCount) {
+                   knownBad = ro;
+                   continue;
+               }
+
                shared->pkgFileNum = i;
                shared->otherPkg = matches[i].recs[j].recOffset;
                shared->otherFileNum = matches[i].recs[j].fileNumber;
@@ -378,6 +395,7 @@ int rpmRunTransactions(rpmTransactionSet ts, rpmCallbackFunction notify,
            }
            dbiFreeIndexRecord(matches[i]);
        }
+       numShared = shared - sharedList;
        shared->otherPkg = -1;
        free(matches);