Panu Matilainen 2742b0
From 474ba1c63e3b790221b21fbd835427146431f874 Mon Sep 17 00:00:00 2001
Panu Matilainen 2742b0
Message-Id: <474ba1c63e3b790221b21fbd835427146431f874.1650878284.git.pmatilai@redhat.com>
Panu Matilainen 2742b0
From: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 2742b0
Date: Mon, 25 Apr 2022 12:17:19 +0300
Panu Matilainen 2742b0
Subject: [PATCH] Revert "Fix shared colored files not removed on erasure
Panu Matilainen 2742b0
 regression in >= 4.14.0"
Panu Matilainen 2742b0
Panu Matilainen 2742b0
This causes a worse regression by removing files on update, revert
Panu Matilainen 2742b0
for further investigation.
Panu Matilainen 2742b0
Panu Matilainen 2742b0
This reverts commit 9e4caf0fc536d1244b298abd9dc4c535b6560d69.
Panu Matilainen 2742b0
---
Panu Matilainen 2742b0
 lib/transaction.c | 34 +++-------------------------------
Panu Matilainen 2742b0
 tests/rpme.at     |  2 ++
Panu Matilainen 2742b0
 2 files changed, 5 insertions(+), 31 deletions(-)
Panu Matilainen 2742b0
Panu Matilainen 2742b0
diff --git a/lib/transaction.c b/lib/transaction.c
Panu Matilainen 2742b0
index ee3552c48..456c0c6de 100644
Panu Matilainen 2742b0
--- a/lib/transaction.c
Panu Matilainen 2742b0
+++ b/lib/transaction.c
Panu Matilainen 2742b0
@@ -516,28 +516,6 @@ static void handleInstInstalledFile(const rpmts ts, rpmte p, rpmfiles fi, int fx
Panu Matilainen 2742b0
     }
Panu Matilainen 2742b0
 }
Panu Matilainen 2742b0
 
Panu Matilainen 2742b0
-static rpmFileAction getSkipAction(rpmfiles files, int i)
Panu Matilainen 2742b0
-{
Panu Matilainen 2742b0
-    rpmFileAction action = FA_UNKNOWN;
Panu Matilainen 2742b0
-
Panu Matilainen 2742b0
-    switch (rpmfilesFState(files, i)) {
Panu Matilainen 2742b0
-    case RPMFILE_STATE_REPLACED:
Panu Matilainen 2742b0
-    case RPMFILE_STATE_NOTINSTALLED:
Panu Matilainen 2742b0
-	action = FA_SKIPNSTATE;
Panu Matilainen 2742b0
-	break;
Panu Matilainen 2742b0
-    case RPMFILE_STATE_NETSHARED:
Panu Matilainen 2742b0
-	action = FA_SKIPNETSHARED;
Panu Matilainen 2742b0
-	break;
Panu Matilainen 2742b0
-    case RPMFILE_STATE_WRONGCOLOR:
Panu Matilainen 2742b0
-	action = FA_SKIPCOLOR;
Panu Matilainen 2742b0
-	break;
Panu Matilainen 2742b0
-    default:
Panu Matilainen 2742b0
-	break;
Panu Matilainen 2742b0
-    }
Panu Matilainen 2742b0
-
Panu Matilainen 2742b0
-    return action;
Panu Matilainen 2742b0
-}
Panu Matilainen 2742b0
-
Panu Matilainen 2742b0
 /**
Panu Matilainen 2742b0
  * Update disk space needs on each partition for this package's files.
Panu Matilainen 2742b0
  */
Panu Matilainen 2742b0
@@ -706,22 +684,16 @@ assert(otherFi != NULL);
Panu Matilainen 2742b0
                 /* Here is an overlapped added file we don't want to nuke. */
Panu Matilainen 2742b0
 		if (rpmfsGetAction(otherFs, otherFileNum) != FA_ERASE) {
Panu Matilainen 2742b0
 		    /* On updates, don't remove files. */
Panu Matilainen 2742b0
-		    if (!getSkipAction(otherFi, otherFileNum)) {
Panu Matilainen 2742b0
-			rpmfsSetAction(fs, i, FA_SKIP);
Panu Matilainen 2742b0
-			break;
Panu Matilainen 2742b0
-		    }
Panu Matilainen 2742b0
+		    rpmfsSetAction(fs, i, FA_SKIP);
Panu Matilainen 2742b0
+		    break;
Panu Matilainen 2742b0
 		}
Panu Matilainen 2742b0
 		/* Here is an overlapped removed file: skip in previous. */
Panu Matilainen 2742b0
 		rpmfsSetAction(otherFs, otherFileNum, FA_SKIP);
Panu Matilainen 2742b0
 	    }
Panu Matilainen 2742b0
 	    if (XFA_SKIPPING(rpmfsGetAction(fs, i)))
Panu Matilainen 2742b0
 		break;
Panu Matilainen 2742b0
-
Panu Matilainen 2742b0
 	    if (rpmfilesFState(fi, i) != RPMFILE_STATE_NORMAL) {
Panu Matilainen 2742b0
-		rpmFileAction skip = getSkipAction(fi, i);
Panu Matilainen 2742b0
-		if (skip) {
Panu Matilainen 2742b0
-		    rpmfsSetAction(fs, i, skip);
Panu Matilainen 2742b0
-		}
Panu Matilainen 2742b0
+		rpmfsSetAction(fs, i, FA_SKIP);
Panu Matilainen 2742b0
 		break;
Panu Matilainen 2742b0
 	    }
Panu Matilainen 2742b0
 		
Panu Matilainen 2742b0
diff --git a/tests/rpme.at b/tests/rpme.at
Panu Matilainen 2742b0
index ec73700c3..f46d64a6b 100644
Panu Matilainen 2742b0
--- a/tests/rpme.at
Panu Matilainen 2742b0
+++ b/tests/rpme.at
Panu Matilainen 2742b0
@@ -167,6 +167,7 @@ AT_CLEANUP
Panu Matilainen 2742b0
 
Panu Matilainen 2742b0
 # Test that shared colored files actually get removed regardless of order 1
Panu Matilainen 2742b0
 AT_SETUP([rpm -e and verify colored files removed 2.1])
Panu Matilainen 2742b0
+AT_XFAIL_IF([test $RPM_XFAIL -ne 0])
Panu Matilainen 2742b0
 AT_KEYWORDS([install erase rpmdb])
Panu Matilainen 2742b0
 RPMDB_INIT
Panu Matilainen 2742b0
 AT_CHECK([
Panu Matilainen 2742b0
@@ -191,6 +192,7 @@ AT_CLEANUP
Panu Matilainen 2742b0
 
Panu Matilainen 2742b0
 # Test that shared colored files actually get removed regardless of order 2
Panu Matilainen 2742b0
 AT_SETUP([rpm -e and verify colored files removed 2.2])
Panu Matilainen 2742b0
+AT_XFAIL_IF([test $RPM_XFAIL -ne 0])
Panu Matilainen 2742b0
 AT_KEYWORDS([install erase rpmdb])
Panu Matilainen 2742b0
 RPMDB_INIT
Panu Matilainen 2742b0
 AT_CHECK([
Panu Matilainen 2742b0
-- 
Panu Matilainen 2742b0
2.35.1
Panu Matilainen 2742b0