Handle erased packages wrt disk-space problem reporting (RhBug:561160)
authorPanu Matilainen <pmatilai@redhat.com>
Thu, 4 Feb 2010 13:55:16 +0000 (15:55 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Thu, 4 Feb 2010 13:55:16 +0000 (15:55 +0200)
- erased packages in the transaction cause space needs to shrink, which
  commit 2222e81e1cf74bbf78acb9969592ab06e2289929 failed to take into
  account, causing false disk space errors from unaffected packages
- adjust obneeded and oineeded when the requirements shrink
- new disk space problems can only occur when the requirements grow,
  change the pmtsCheckDSIProblems() check to reflect that (although not
  strictly necessary)

lib/transaction.c

index d913258..7d12eeb 100644 (file)
@@ -219,6 +219,10 @@ static void rpmtsUpdateDSI(const rpmts ts, dev_t dev, const char *dirName,
 
     if (fixupSize)
        dsi->bneeded -= BLOCK_ROUND(fixupSize, dsi->bsize);
+
+    /* adjust bookkeeping when requirements shrink */
+    if (dsi->bneeded < dsi->obneeded) dsi->obneeded = dsi->bneeded;
+    if (dsi->ineeded < dsi->oineeded) dsi->oineeded = dsi->ineeded;
 }
 
 static void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
@@ -238,7 +242,7 @@ static void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
     for (; dsi->bsize; dsi++) {
 
        if (dsi->bavail >= 0 && adj_fs_blocks(dsi->bneeded) > dsi->bavail) {
-           if (dsi->bneeded != dsi->obneeded) {
+           if (dsi->bneeded > dsi->obneeded) {
                rpmpsAppend(ps, RPMPROB_DISKSPACE,
                        rpmteNEVRA(te), rpmteKey(te),
                        dsi->mntPoint, NULL, NULL,
@@ -248,7 +252,7 @@ static void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
        }
 
        if (dsi->iavail >= 0 && adj_fs_blocks(dsi->ineeded) > dsi->iavail) {
-           if (dsi->ineeded != dsi->oineeded) {
+           if (dsi->ineeded > dsi->oineeded) {
                rpmpsAppend(ps, RPMPROB_DISKNODES,
                        rpmteNEVRA(te), rpmteKey(te),
                        dsi->mntPoint, NULL, NULL,