teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone
Blob Blame History Raw
commit 4e4aec28c544f2884cb76be37d508f376db5cb7c
Author: Panu Matilainen <pmatilai@redhat.com>
Date:   Thu Feb 4 15:55:16 2010 +0200

    Handle erased packages wrt disk-space problem reporting (RhBug:561160)
    - 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)

diff --git a/lib/transaction.c b/lib/transaction.c
index d913258..7d12eeb 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -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,