!336 [sync] PR-335: backport bugfix from upstream

From: @openeuler-sync-bot 
Reviewed-by: @xujing99 
Signed-off-by: @xujing99
This commit is contained in:
openeuler-ci-bot 2024-06-07 01:11:51 +00:00 committed by Gitee
commit f016e08c45
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 232 additions and 1 deletions

View File

@ -0,0 +1,36 @@
From 7108c172f4e60c83ecc1eeb2a766eb7eaa5956d7 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Fri, 15 Mar 2024 10:03:26 +0200
Subject: [PATCH] An enumeration is not a bitfield, use an integer instead
Enums are good for individual bitfield flag names, but combination of
the bits is not a legit value really.
Conflict:don't modify rpmfileutil.h because 8ef29094fa is not mearged; adapt context.
Reference:https://github.com/rpm-software-management/rpm/commit/7108c172f4e60c83ecc1eeb2a766eb7eaa5956d7
---
include/rpm/rpmmacro.h | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/rpm/rpmmacro.h b/include/rpm/rpmmacro.h
index 979763a76..7b23fda59 100644
--- a/include/rpm/rpmmacro.h
+++ b/include/rpm/rpmmacro.h
@@ -62,10 +62,11 @@ extern const char * macrofiles;
/* rpm macro expansion flags */
#define RPMEXPAND_EXPAND_ARGS (1 << 0) /*!< expand arguments of parametric macros */
-typedef enum rpmMacroFlags_e {
+enum rpmMacroFlags_e {
RPMMACRO_DEFAULT = 0,
RPMMACRO_LITERAL = (1 << 0), /*!< do not expand body of macro */
-} rpmMacroFlags;
+};
+typedef rpmFlags rpmMacroFlags;
/** \ingroup rpmmacro
* Print macros to file stream.
--
2.33.0

View File

@ -0,0 +1,32 @@
From 6c01f4c84f768b6c6b247a11106bf51b40015e66 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 18 Mar 2024 09:56:51 +0200
Subject: [PATCH] Fix an enum/int type mismatch in rpmfiArchiveReadToFilePsm()
rpmfiDigestAlgo() hysterically returns a signed int (and that's what
really ought to be changed) but lets at least make all these uses
consistent.
Conflict:NA
Reference:https://github.com/rpm-software-management/rpm/commit/6c01f4c84f768b6c6b247a11106bf51b40015e66
---
lib/rpmfi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/rpmfi.c b/lib/rpmfi.c
index cfb388b4c..db1460711 100644
--- a/lib/rpmfi.c
+++ b/lib/rpmfi.c
@@ -2384,7 +2384,7 @@ int rpmfiArchiveReadToFilePsm(rpmfi fi, FD_t fd, int nodigest, rpmpsm psm)
rpm_loff_t left = rpmfiFSize(fi);
const unsigned char * fidigest = NULL;
- rpmHashAlgo digestalgo = 0;
+ int digestalgo = 0;
int rc = 0;
char buf[BUFSIZ*4];
--
2.33.0

View File

@ -0,0 +1,28 @@
From 90cfa466ae88b06595012084eada25a42064322c Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 18 Mar 2024 09:48:48 +0200
Subject: [PATCH] Fix an enum/int type mismatch in transaction verify code
Conflict:NA
Reference:https://github.com/rpm-software-management/rpm/commit/90cfa466ae88b06595012084eada25a42064322c
---
lib/transaction.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/transaction.c b/lib/transaction.c
index fcde554a6..6a49eb242 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -1288,7 +1288,7 @@ static int verifyPackageFiles(rpmts ts, rpm_loff_t total)
.vfylevel = vfylevel,
};
int verified = 0;
- rpmRC prc = RPMRC_FAIL;
+ int prc = RPMRC_FAIL;
rpmtsNotify(ts, p, RPMCALLBACK_VERIFY_PROGRESS, oc++, total);
FD_t fd = rpmtsNotify(ts, p, RPMCALLBACK_INST_OPEN_FILE, 0, 0);
--
2.33.0

View File

@ -0,0 +1,30 @@
From 3a227fdf2965aa6bfc0727170419e9da6cf1fbe2 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 18 Mar 2024 09:50:05 +0200
Subject: [PATCH] Fix enum type mismatch in rpmTagGetValue()
This returns a tag value, not type.
Conflict:NA
Reference:https://github.com/rpm-software-management/rpm/commit/3a227fdf2965aa6bfc0727170419e9da6cf1fbe2
---
lib/tagname.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/tagname.c b/lib/tagname.c
index 4e7c30d2b..4748cf19c 100644
--- a/lib/tagname.c
+++ b/lib/tagname.c
@@ -171,7 +171,7 @@ rpmTagType rpmTagGetType(rpmTagVal tag)
rpmTagVal rpmTagGetValue(const char * tagstr)
{
const struct headerTagTableEntry_s *t;
- rpmTagType tagval = RPMTAG_NOT_FOUND;
+ rpmTagVal tagval = RPMTAG_NOT_FOUND;
pthread_once(&tagsLoaded, loadTags);
--
2.33.0

View File

@ -0,0 +1,68 @@
From f2eb6fa6ba77fbf5f62add8a01544cce8c0beb6b Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Fri, 15 Mar 2024 16:41:28 +0200
Subject: [PATCH] Fix some int/enum confusion in the build code
These things are not really returning rpmRC values, especially as they
need to pass around RPMRC_MISSINGBUILDREQUIRES which is not part of the
enum.
For doRmSource(), 0 and 1 aren't any more enums values than 0 and -1 are,
and besides, the sole caller isn't even checking the return code.
Conflict:NA
Reference:https://github.com/rpm-software-management/rpm/commit/f2eb6fa6ba77fbf5f62add8a01544cce8c0beb6b
---
build/build.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/build/build.c b/build/build.c
index 8e6c8f842..69ab69fc9 100644
--- a/build/build.c
+++ b/build/build.c
@@ -78,7 +78,7 @@ static char * buildHost(void)
/**
*/
-static rpmRC doRmSource(rpmSpec spec)
+static int doRmSource(rpmSpec spec)
{
struct Source *p;
Package pkg;
@@ -100,7 +100,7 @@ static rpmRC doRmSource(rpmSpec spec)
}
}
exit:
- return !rc ? 0 : 1;
+ return rc;
}
/*
@@ -290,9 +290,9 @@ static int doBuildRequires(rpmSpec spec, int test)
return rc;
}
-static rpmRC doCheckBuildRequires(rpmts ts, rpmSpec spec, int test)
+static int doCheckBuildRequires(rpmts ts, rpmSpec spec, int test)
{
- rpmRC rc = RPMRC_OK;
+ int rc = RPMRC_OK;
rpmps ps = rpmSpecCheckDeps(ts, spec);
if (ps) {
@@ -323,9 +323,9 @@ static rpmRC doBuildDir(rpmSpec spec, int test, StringBuf *sbp)
return rc;
}
-static rpmRC buildSpec(rpmts ts, BTA_t buildArgs, rpmSpec spec, int what)
+static int buildSpec(rpmts ts, BTA_t buildArgs, rpmSpec spec, int what)
{
- rpmRC rc = RPMRC_OK;
+ int rc = RPMRC_OK;
int missing_buildreqs = 0;
int test = (what & RPMBUILD_NOBUILD);
char *cookie = buildArgs->cookie ? xstrdup(buildArgs->cookie) : NULL;
--
2.33.0

View File

@ -0,0 +1,28 @@
From 1d6987a8ede061db611ff02eda62315e0ae24d2b Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 18 Mar 2024 10:02:52 +0200
Subject: [PATCH] Use the internal DB_CTRL* enum for intenal uses consistently
Conflict:NA
Reference:https://github.com/rpm-software-management/rpm/commit/1d6987a8ede061db611ff02eda62315e0ae24d2b
---
lib/rpmdb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/rpmdb.c b/lib/rpmdb.c
index 2f0d72afd..4ad12230b 100644
--- a/lib/rpmdb.c
+++ b/lib/rpmdb.c
@@ -69,7 +69,7 @@ static int buildIndexes(rpmdb db)
dbSetFSync(db, 0);
- dbCtrl(db, RPMDB_CTRL_LOCK_RW);
+ dbCtrl(db, DB_CTRL_LOCK_RW);
mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, NULL, 0);
while ((h = rpmdbNextIterator(mi))) {
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: rpm
Version: 4.18.2
Release: 5
Release: 6
Summary: RPM Package Manager
License: GPLv2+
URL: http://www.rpm.org/
@ -26,6 +26,12 @@ Patch6004: backport-Fix-spec-parser-leaks-from-trans-f-file.patch
Patch6005: backport-Tip-toe-around-rpmfiFN-thin-ice-in-fsm.patch
Patch6006: backport-Fix-a-memleak-on-invalid-command-line-options.patch
Patch6007: backport-Let-eBPF-ELF-files-be-packaged-in-noarch-packages.patch
Patch6008: backport-Fix-some-int-enum-confusion-in-the-build-code.patch
Patch6009: backport-Use-the-internal-DB_CTRL-enum-for-intenal-uses-consi.patch
Patch6010: backport-An-enumeration-is-not-a-bitfield-use-an-integer-inst.patch
Patch6011: backport-Fix-an-enum-int-type-mismatch-in-rpmfiArchiveReadToF.patch
Patch6012: backport-Fix-an-enum-int-type-mismatch-in-transaction-verify-.patch
Patch6013: backport-Fix-enum-type-mismatch-in-rpmTagGetValue.patch
Patch9000: Add-digest-list-plugin.patch
Patch9001: Add-IMA-digest-list-support.patch
@ -324,6 +330,9 @@ make clean
%exclude %{_mandir}/man8/rpmspec.8.gz
%changelog
* Mon Jun 3 2024 gengqihu<gengqihu2@h-partners.com> - 4.18.2-6
- Backport some patches from upstream
* Mon Mar 25 2024 hongjinghao<hongjinghao@huawei.com> - 4.18.2-5
- Fix memleak and let eBPF ELF files be packaged in noarch packages