teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.8.0-erasure-dsi.patch

Panu Matilainen eb0cb8
commit 4e4aec28c544f2884cb76be37d508f376db5cb7c
Panu Matilainen eb0cb8
Author: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen eb0cb8
Date:   Thu Feb 4 15:55:16 2010 +0200
Panu Matilainen eb0cb8
Panu Matilainen eb0cb8
    Handle erased packages wrt disk-space problem reporting (RhBug:561160)
Panu Matilainen eb0cb8
    - erased packages in the transaction cause space needs to shrink, which
Panu Matilainen eb0cb8
      commit 2222e81e1cf74bbf78acb9969592ab06e2289929 failed to take into
Panu Matilainen eb0cb8
      account, causing false disk space errors from unaffected packages
Panu Matilainen eb0cb8
    - adjust obneeded and oineeded when the requirements shrink
Panu Matilainen eb0cb8
    - new disk space problems can only occur when the requirements grow,
Panu Matilainen eb0cb8
      change the pmtsCheckDSIProblems() check to reflect that (although not
Panu Matilainen eb0cb8
      strictly necessary)
Panu Matilainen eb0cb8
Panu Matilainen eb0cb8
diff --git a/lib/transaction.c b/lib/transaction.c
Panu Matilainen eb0cb8
index d913258..7d12eeb 100644
Panu Matilainen eb0cb8
--- a/lib/transaction.c
Panu Matilainen eb0cb8
+++ b/lib/transaction.c
Panu Matilainen eb0cb8
@@ -219,6 +219,10 @@ static void rpmtsUpdateDSI(const rpmts ts, dev_t dev, const char *dirName,
Panu Matilainen eb0cb8
 
Panu Matilainen eb0cb8
     if (fixupSize)
Panu Matilainen eb0cb8
 	dsi->bneeded -= BLOCK_ROUND(fixupSize, dsi->bsize);
Panu Matilainen eb0cb8
+
Panu Matilainen eb0cb8
+    /* adjust bookkeeping when requirements shrink */
Panu Matilainen eb0cb8
+    if (dsi->bneeded < dsi->obneeded) dsi->obneeded = dsi->bneeded;
Panu Matilainen eb0cb8
+    if (dsi->ineeded < dsi->oineeded) dsi->oineeded = dsi->ineeded;
Panu Matilainen eb0cb8
 }
Panu Matilainen eb0cb8
 
Panu Matilainen eb0cb8
 static void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
Panu Matilainen eb0cb8
@@ -238,7 +242,7 @@ static void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
Panu Matilainen eb0cb8
     for (; dsi->bsize; dsi++) {
Panu Matilainen eb0cb8
 
Panu Matilainen eb0cb8
 	if (dsi->bavail >= 0 && adj_fs_blocks(dsi->bneeded) > dsi->bavail) {
Panu Matilainen eb0cb8
-	    if (dsi->bneeded != dsi->obneeded) {
Panu Matilainen eb0cb8
+	    if (dsi->bneeded > dsi->obneeded) {
Panu Matilainen eb0cb8
 		rpmpsAppend(ps, RPMPROB_DISKSPACE,
Panu Matilainen eb0cb8
 			rpmteNEVRA(te), rpmteKey(te),
Panu Matilainen eb0cb8
 			dsi->mntPoint, NULL, NULL,
Panu Matilainen eb0cb8
@@ -248,7 +252,7 @@ static void rpmtsCheckDSIProblems(const rpmts ts, const rpmte te)
Panu Matilainen eb0cb8
 	}
Panu Matilainen eb0cb8
 
Panu Matilainen eb0cb8
 	if (dsi->iavail >= 0 && adj_fs_blocks(dsi->ineeded) > dsi->iavail) {
Panu Matilainen eb0cb8
-	    if (dsi->ineeded != dsi->oineeded) {
Panu Matilainen eb0cb8
+	    if (dsi->ineeded > dsi->oineeded) {
Panu Matilainen eb0cb8
 		rpmpsAppend(ps, RPMPROB_DISKNODES,
Panu Matilainen eb0cb8
 			rpmteNEVRA(te), rpmteKey(te),
Panu Matilainen eb0cb8
 			dsi->mntPoint, NULL, NULL,