summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/rpm/rpm/rpm-tag-generate-endian-conversion-fix.patch49
-rw-r--r--meta/recipes-devtools/rpm/rpm_5.4.9.bb1
2 files changed, 50 insertions, 0 deletions
diff --git a/meta/recipes-devtools/rpm/rpm/rpm-tag-generate-endian-conversion-fix.patch b/meta/recipes-devtools/rpm/rpm/rpm-tag-generate-endian-conversion-fix.patch
new file mode 100644
index 0000000000..e487b821b2
--- /dev/null
+++ b/meta/recipes-devtools/rpm/rpm/rpm-tag-generate-endian-conversion-fix.patch
@@ -0,0 +1,49 @@
1fix a endian incompatible error in generating rpm tag
2
3A flaw was found in the way rpm generating arbitrary tags, which leads to a
4incorrect query result, this issue is introduced by a incompatible endianess
5when the generating process is executed on different architectures.
6
7This patch resolves it by taking the byte order that host uses.
8
9Upstream-Status: Pending
10
11Signed-off-by: Ming Liu <ming.liu@windriver.com>
12---
13 tagname.c | 16 ++++++++++++++++
14 1 file changed, 16 insertions(+)
15
16diff -urpN a/rpmdb/tagname.c b/rpmdb/tagname.c
17--- a/rpmdb/tagname.c
18+++ b/rpmdb/tagname.c
19@@ -3,6 +3,19 @@
20 */
21
22 #include "system.h"
23+#include <endian.h>
24+
25+/* Don't redefine this macro if it already exists */
26+#ifndef le32toh
27+#ifdef __USE_BSD
28+#include <byteswap.h>
29+#if __BYTE_ORDER == __LITTLE_ENDIAN
30+#define le32toh(x) (x)
31+#else
32+#define le32toh(x) __bswap_32(x)
33+#endif
34+#endif /* __USE_BSD */
35+#endif /* le32toh */
36
37 #include <rpmio_internal.h> /* XXX DIGEST_CTX, xtolower, xstrcasecmp */
38 #include <rpmmacro.h>
39@@ -152,7 +165,10 @@ static rpmTag _tagGenerate(const char *s
40 xx = rpmDigestUpdate(ctx, s, nb);
41 xx = rpmDigestFinal(ctx, &digest, &digestlen, 0);
42 if (digest && digestlen > 4) {
43+ /* The tag is stored in a uniform byte order for cross-endian compatibility.
44+ Swap to the host uses. */
45 memcpy(&tag, digest + (digestlen - 4), 4);
46+ tag = le32toh(tag);
47 tag = (rpmTag) (tag & 0x3fffffff);
48 tag = (rpmTag) (tag | 0x40000000);
49 }
diff --git a/meta/recipes-devtools/rpm/rpm_5.4.9.bb b/meta/recipes-devtools/rpm/rpm_5.4.9.bb
index 9d376a5b31..7921f40769 100644
--- a/meta/recipes-devtools/rpm/rpm_5.4.9.bb
+++ b/meta/recipes-devtools/rpm/rpm_5.4.9.bb
@@ -89,6 +89,7 @@ SRC_URI = "http://www.rpm5.org/files/rpm/rpm-5.4/rpm-5.4.9-0.20120508.src.rpm;ex
89 file://debugedit-valid-file-to-fix-segment-fault.patch \ 89 file://debugedit-valid-file-to-fix-segment-fault.patch \
90 file://rpm-platform-file-fix.patch \ 90 file://rpm-platform-file-fix.patch \
91 file://rpm-lsb-compatibility.patch \ 91 file://rpm-lsb-compatibility.patch \
92 file://rpm-tag-generate-endian-conversion-fix.patch \
92 " 93 "
93 94
94# Uncomment the following line to enable platform score debugging 95# Uncomment the following line to enable platform score debugging