From 7a9194076dfd3e4cdec4e64e86d6f428af30fdb7 Mon Sep 17 00:00:00 2001
From: Niels Thykier <niels@thykier.net>
Date: Sun, 3 May 2020 19:05:41 +0000
Subject: [PATCH 5/5] Handle remove-on-upgrade like obsolete in some cases

Signed-off-by: Niels Thykier <niels@thykier.net>
---
 src/archives.c  | 2 +-
 src/configure.c | 2 +-
 src/help.c      | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/archives.c b/src/archives.c
index b147281e86..8f68075fec 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -235,7 +235,7 @@ md5hash_prev_conffile(struct pkginfo *pkg, char *oldhash, const char *oldname,
                              &otherpkg->configversion) != 0)
       continue;
     for (conff = otherpkg->installed.conffiles; conff; conff = conff->next) {
-      if (conff->obsolete)
+      if (conff->obsolete || conff->remove_on_upgrade)
         continue;
       if (strcmp(conff->name, namenode->name) == 0)
         break;
diff --git a/src/configure.c b/src/configure.c
index 674d8c4458..c0a298d0c3 100644
--- a/src/configure.c
+++ b/src/configure.c
@@ -356,7 +356,7 @@ deferred_configure_ghost_conffile(struct pkginfo *pkg, struct conffile *conff)
 
 		for (otherconff = otherpkg->installed.conffiles; otherconff;
 		     otherconff = otherconff->next) {
-			if (otherconff->obsolete)
+			if (otherconff->obsolete || otherconff->remove_on_upgrade)
 				continue;
 
 			/* Check if we need to propagate the new hash from
diff --git a/src/help.c b/src/help.c
index f8f8a80708..e075ff2015 100644
--- a/src/help.c
+++ b/src/help.c
@@ -228,7 +228,7 @@ dir_has_conffiles(struct fsys_namenode *file, struct pkginfo *pkg)
         pkg_name(pkg, pnaw_always));
   namelen = strlen(file->name);
   for (conff= pkg->installed.conffiles; conff; conff= conff->next) {
-      if (conff->obsolete)
+      if (conff->obsolete || conff->remove_on_upgrade)
         continue;
       if (strncmp(file->name, conff->name, namelen) == 0 &&
           strlen(conff->name) > namelen && conff->name[namelen] == '/') {
-- 
2.26.2

