5523e9
From 3c99b06c7776345cfc3a3d4fd0c59fe671644317 Mon Sep 17 00:00:00 2001
5523e9
From: Lubos Kardos <lkardos@redhat.com>
5523e9
Date: Wed, 21 Oct 2015 15:25:47 +0200
5523e9
Subject: [PATCH] Overwrite a file if it is not marked as config any more.
5523e9
5523e9
If a file was marked as config in the previous version of a package but
5523e9
it is not marked as config in currently being installed version of
5523e9
the package then backup the old file as .rpmsave and overwrite it with
5523e9
the new file. (rhbz:1263859)
5523e9
---
5523e9
 lib/rpmfi.c | 12 ++++++++++++
5523e9
 1 file changed, 12 insertions(+)
5523e9
5523e9
diff --git a/lib/rpmfi.c b/lib/rpmfi.c
5523e9
index 924ff4b..28a697e 100644
5523e9
--- a/lib/rpmfi.c
5523e9
+++ b/lib/rpmfi.c
5523e9
@@ -1040,6 +1040,12 @@ rpmFileAction rpmfilesDecideFate(rpmfiles ofi, int oix,
5523e9
 	        goto exit;		/* file identical in new, replace. */
5523e9
 	}
5523e9
 
5523e9
+	/* if new file is no longer config, backup it and replace it */
5523e9
+	if (!(newFlags & RPMFILE_CONFIG)) {
5523e9
+	    action = FA_SAVE;
5523e9
+	    goto exit;
5523e9
+	}
5523e9
+
5523e9
 	/* If file can be determined identical in old and new pkg, let it be */
5523e9
 	if (newWhat == REG && oalgo == nalgo && odiglen == ndiglen) {
5523e9
 	    if (odigest && ndigest && memcmp(odigest, ndigest, odiglen) == 0) {
5523e9
@@ -1071,6 +1077,12 @@ rpmFileAction rpmfilesDecideFate(rpmfiles ofi, int oix,
5523e9
 		goto exit;		/* unmodified config file, replace. */
5523e9
 	}
5523e9
 
5523e9
+	/* if new file is no longer config, backup it and replace it */
5523e9
+	if (!(newFlags & RPMFILE_CONFIG)) {
5523e9
+	    action = FA_SAVE;
5523e9
+	    goto exit;
5523e9
+	}
5523e9
+
5523e9
 	/* If link is identical in old and new pkg, let it be */
5523e9
 	if (newWhat == LINK && oFLink && nFLink && rstreq(oFLink, nFLink)) {
5523e9
 	    action = FA_SKIP;		/* identical file, don't bother. */
5523e9
-- 
5523e9
2.5.5
5523e9