82 lines
2.2 KiB
Diff
82 lines
2.2 KiB
Diff
From 8ecd5fc6884ae165e38e16b900cc4da90665b9db Mon Sep 17 00:00:00 2001
|
|
From: Roberto Sassu <roberto.sassu@huawei.com>
|
|
Date: Wed, 10 Mar 2021 12:22:39 +0100
|
|
Subject: [PATCH 1/5] Fix digest_list_counter
|
|
|
|
---
|
|
plugins/digest_list.c | 38 +++++++++++++++++++++++---------------
|
|
1 file changed, 23 insertions(+), 15 deletions(-)
|
|
|
|
diff --git a/plugins/digest_list.c b/plugins/digest_list.c
|
|
index 2dfa21e35..bb778c57f 100644
|
|
--- a/plugins/digest_list.c
|
|
+++ b/plugins/digest_list.c
|
|
@@ -477,8 +477,8 @@ int digest_list_counter;
|
|
static rpmRC digest_list_psm_pre(rpmPlugin plugin, rpmte te)
|
|
{
|
|
Header rpm = rpmteHeader(te);
|
|
- rpmtd dirnames;
|
|
- int i;
|
|
+ rpmtd dirnames, dirindexes;
|
|
+ int i = -1;
|
|
|
|
digest_list_counter = 0;
|
|
|
|
@@ -487,13 +487,26 @@ static rpmRC digest_list_psm_pre(rpmPlugin plugin, rpmte te)
|
|
|
|
while ((i = rpmtdNext(dirnames)) >= 0) {
|
|
char *dirname = (char *) rpmtdGetString(dirnames);
|
|
+
|
|
if (!strncmp(dirname, DIGEST_LIST_DEFAULT_PATH,
|
|
- sizeof(DIGEST_LIST_DEFAULT_PATH) - 1))
|
|
- digest_list_counter++;
|
|
+ sizeof(DIGEST_LIST_DEFAULT_PATH) - 1) &&
|
|
+ dirname[sizeof(DIGEST_LIST_DEFAULT_PATH) - 1] == '/')
|
|
+ break;
|
|
}
|
|
|
|
rpmtdFree(dirnames);
|
|
|
|
+ if (i == -1)
|
|
+ return RPMRC_OK;
|
|
+
|
|
+ dirindexes = rpmtdNew();
|
|
+ headerGet(rpm, RPMTAG_DIRINDEXES, dirindexes, 0);
|
|
+ while (rpmtdNext(dirindexes) >= 0)
|
|
+ if (rpmtdGetNumber(dirindexes) == i)
|
|
+ digest_list_counter++;
|
|
+
|
|
+ rpmtdFree(dirindexes);
|
|
+
|
|
cur_te = te;
|
|
return RPMRC_OK;
|
|
}
|
|
@@ -517,18 +530,13 @@ static rpmRC digest_list_file_common(rpmPlugin plugin, rpmfi fi,
|
|
(!pre && action != FA_CREATE))
|
|
return RPMRC_OK;
|
|
|
|
- if (digest_list_counter) {
|
|
- if (!pre) {
|
|
- if (!strncmp(path, DIGEST_LIST_DEFAULT_PATH,
|
|
- sizeof(DIGEST_LIST_DEFAULT_PATH) - 1))
|
|
- digest_list_counter--;
|
|
- } else {
|
|
- digest_list_counter = 0;
|
|
- }
|
|
+ if (strncmp(path, DIGEST_LIST_DEFAULT_PATH,
|
|
+ sizeof(DIGEST_LIST_DEFAULT_PATH) - 1) ||
|
|
+ path[sizeof(DIGEST_LIST_DEFAULT_PATH) - 1] != '/')
|
|
+ return RPMRC_OK;
|
|
|
|
- if (digest_list_counter)
|
|
- return RPMRC_OK;
|
|
- }
|
|
+ if (!pre && --digest_list_counter)
|
|
+ return RPMRC_OK;
|
|
|
|
process_digest_list(cur_te, 0);
|
|
if (!strcmp(rpmteN(cur_te), "digest-list-tools"))
|
|
--
|
|
2.26.2
|
|
|