From 2c27c71952ce3ac61afeabd3ef4e1d182574e905 Mon Sep 17 00:00:00 2001
From: luhuaxin <luhuaxin1@huawei.com>
Date: Tue, 15 Mar 2022 20:54:06 +0800
Subject: [PATCH] dont remove ima xattr of parser when upgrading

Signed-off-by: luhuaxin <luhuaxin1@huawei.com>
---
 plugins/digest_list.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/plugins/digest_list.c b/plugins/digest_list.c
index 0692b5b..1d7ef92 100644
--- a/plugins/digest_list.c
+++ b/plugins/digest_list.c
@@ -576,9 +576,16 @@ static rpmRC digest_list_file_common(rpmPlugin plugin, rpmfi fi,
 	if (!pre && --digest_list_counter)
 		return RPMRC_OK;
 
+	rpmlog(RPMLOG_DEBUG, "process ima digest, pre: %d, action: %d, teType: %d\n",
+		pre, action, rpmteType(cur_te));
 	process_digest_list(cur_te, 0, pre);
-	if (!strcmp(rpmteN(cur_te), "digest-list-tools"))
+	if (!strcmp(rpmteN(cur_te), "digest-list-tools")) {
+		if (pre && rpmteType(cur_te) == TR_REMOVED)
+			return RPMRC_OK;
+
+		rpmlog(RPMLOG_DEBUG, "process parser digest\n");
 		process_digest_list(cur_te, 1, pre);
+	}
 
 	return RPMRC_OK;
 }
-- 
2.33.0

