[OE-core] [PATCH 1/1] rpm: fix rpm2cpio segmentation fault

Kai Kang kai.kang at windriver.com
Mon Sep 30 09:48:25 UTC 2013


From: Kang Kai <kai.kang at windriver.com>

When run rpm2cpio, it fails with segmentation fault. The root cause is
no macros "_db_path" and "_dbi_config*" defined, when query these macros
get nothing then cause segment fault.

Add patch to parse macro files first to fix this problem.

[YOCTO #3656]

Signed-off-by: Kang Kai <kai.kang at windriver.com>
---
 .../rpm/rpm/rpm2cpio-fix-segmentation-fault.patch  | 28 ++++++++++++++++++++++
 meta/recipes-devtools/rpm/rpm_5.4.9.bb             |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 meta/recipes-devtools/rpm/rpm/rpm2cpio-fix-segmentation-fault.patch

diff --git a/meta/recipes-devtools/rpm/rpm/rpm2cpio-fix-segmentation-fault.patch b/meta/recipes-devtools/rpm/rpm/rpm2cpio-fix-segmentation-fault.patch
new file mode 100644
index 0000000..cdf8fb1
--- /dev/null
+++ b/meta/recipes-devtools/rpm/rpm/rpm2cpio-fix-segmentation-fault.patch
@@ -0,0 +1,28 @@
+Upstream-Status: Pending
+
+rpm2cpio fails on target with "Segmentation fault". Because macros
+"_dbpath" and "_dbi_config*" need to be defined, otherwise query these
+macros will cause segment fault.
+
+Parse config files first to fix this bug. If parse fails, give a warning.
+
+[YOCTO #3656]
+
+Signed-off-by: Kang Kai <kai.kang at windriver.com>
+
+--- rpm-5.4.9/tools/rpm2cpio.c.orig	2013-04-15 10:35:14.269398890 +0800
++++ rpm-5.4.9/tools/rpm2cpio.c	2013-04-15 10:44:12.777417885 +0800
+@@ -87,6 +87,13 @@
+ #endif
+ 	(void) rpmtsSetVSFlags(ts, vsflags);
+ 
++	/* If macros "_dbpath" and "_dbi_config*" are not defined,
++	 * sigment fault occurs */
++	rc = rpmReadConfigFiles(NULL, NULL);
++	if (rc) {
++		fprintf(stderr, _("Read RPM config files failed that may cause sigment fault.\n"));
++	}
++
+ 	/*@-mustmod@*/      /* LCL: segfault */
+ 	rc = rpmReadPackageFile(ts, fdi, "rpm2cpio", &h);
+ 	/*@=mustmod@*/
diff --git a/meta/recipes-devtools/rpm/rpm_5.4.9.bb b/meta/recipes-devtools/rpm/rpm_5.4.9.bb
index 3c7e03b..492393e 100644
--- a/meta/recipes-devtools/rpm/rpm_5.4.9.bb
+++ b/meta/recipes-devtools/rpm/rpm_5.4.9.bb
@@ -88,6 +88,7 @@ SRC_URI = "http://www.rpm5.org/files/rpm/rpm-5.4/rpm-5.4.9-0.20120508.src.rpm;ex
 	   file://debugedit-segv.patch \
 	   file://rpm-platform-file-fix.patch \
 	   file://rpm-lsb-compatibility.patch \
+	   file://rpm2cpio-fix-segmentation-fault.patch \
 	  "
 
 # Uncomment the following line to enable platform score debugging
-- 
1.8.1.2




More information about the Openembedded-core mailing list