Blob Blame History Raw
From 474ba1c63e3b790221b21fbd835427146431f874 Mon Sep 17 00:00:00 2001
Message-Id: <474ba1c63e3b790221b21fbd835427146431f874.1650878284.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 25 Apr 2022 12:17:19 +0300
Subject: [PATCH] Revert "Fix shared colored files not removed on erasure
 regression in >= 4.14.0"

This causes a worse regression by removing files on update, revert
for further investigation.

This reverts commit 9e4caf0fc536d1244b298abd9dc4c535b6560d69.
---
 lib/transaction.c | 34 +++-------------------------------
 tests/rpme.at     |  2 ++
 2 files changed, 5 insertions(+), 31 deletions(-)

diff --git a/lib/transaction.c b/lib/transaction.c
index ee3552c48..456c0c6de 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -516,28 +516,6 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx
     }
 }
 
-static rpmFileAction getSkipAction(rpmfiles files, int i)
-{
-    rpmFileAction action = FA_UNKNOWN;
-
-    switch (rpmfilesFState(files, i)) {
-    case RPMFILE_STATE_REPLACED:
-    case RPMFILE_STATE_NOTINSTALLED:
-	action = FA_SKIPNSTATE;
-	break;
-    case RPMFILE_STATE_NETSHARED:
-	action = FA_SKIPNETSHARED;
-	break;
-    case RPMFILE_STATE_WRONGCOLOR:
-	action = FA_SKIPCOLOR;
-	break;
-    default:
-	break;
-    }
-
-    return action;
-}
-
 /**
  * Update disk space needs on each partition for this package's files.
  */
@@ -706,22 +684,16 @@ assert(otherFi != NULL);
                 /* Here is an overlapped added file we don't want to nuke. */
 		if (rpmfsGetAction(otherFs, otherFileNum) != FA_ERASE) {
 		    /* On updates, don't remove files. */
-		    if (!getSkipAction(otherFi, otherFileNum)) {
-			rpmfsSetAction(fs, i, FA_SKIP);
-			break;
-		    }
+		    rpmfsSetAction(fs, i, FA_SKIP);
+		    break;
 		}
 		/* Here is an overlapped removed file: skip in previous. */
 		rpmfsSetAction(otherFs, otherFileNum, FA_SKIP);
 	    }
 	    if (XFA_SKIPPING(rpmfsGetAction(fs, i)))
 		break;
-
 	    if (rpmfilesFState(fi, i) != RPMFILE_STATE_NORMAL) {
-		rpmFileAction skip = getSkipAction(fi, i);
-		if (skip) {
-		    rpmfsSetAction(fs, i, skip);
-		}
+		rpmfsSetAction(fs, i, FA_SKIP);
 		break;
 	    }
 		
diff --git a/tests/rpme.at b/tests/rpme.at
index ec73700c3..f46d64a6b 100644
--- a/tests/rpme.at
+++ b/tests/rpme.at
@@ -167,6 +167,7 @@ AT_CLEANUP
 
 # Test that shared colored files actually get removed regardless of order 1
 AT_SETUP([rpm -e and verify colored files removed 2.1])
+AT_XFAIL_IF([test $RPM_XFAIL -ne 0])
 AT_KEYWORDS([install erase rpmdb])
 RPMDB_INIT
 AT_CHECK([
@@ -191,6 +192,7 @@ AT_CLEANUP
 
 # Test that shared colored files actually get removed regardless of order 2
 AT_SETUP([rpm -e and verify colored files removed 2.2])
+AT_XFAIL_IF([test $RPM_XFAIL -ne 0])
 AT_KEYWORDS([install erase rpmdb])
 RPMDB_INIT
 AT_CHECK([
-- 
2.35.1