summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rpm
diff options
context:
space:
mode:
authorMing Liu <ming.liu@windriver.com>2014-02-17 16:48:15 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-17 15:37:17 +0000
commitc33c645953bbb95ef3428534f8dbd1672ff10532 (patch)
treea3ec5dbc7e4daa0b8dc0aaa5ef4fdda9dd2b4fb7 /meta/recipes-devtools/rpm
parent0008cd6444dc3c13d5bab4651dbd237f9ed3abfc (diff)
downloadpoky-c33c645953bbb95ef3428534f8dbd1672ff10532.tar.gz
rpm: fix a endian incompatible error in generating tag
A flaw was found in the way rpm generating arbitrary tags, which leads to a incorrect query result, this issue is introduced by a incompatible endianess when the generating process is executed on different architectures. This patch resolves it by taking the byte order that host uses. (From OE-Core rev: b4b79a78012c64e3a19545972512153b1fe64b4d) Signed-off-by: Ming Liu <ming.liu@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rpm')
-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