[OE-core] [PATCH 1/1] rpm: fix rpm2cpio segmentation fault
Mark Hatle
mark.hatle at windriver.com
Thu Feb 28 14:34:44 UTC 2013
On 2/28/13 1:34 AM, Kang Kai wrote:
> When run rpm2cpio, it fails with segmentation fault. The root cause is
> no macro "_db_path" defined, when query its value 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 | 24 ++++++++++++++++++++
> meta/recipes-devtools/rpm/rpm_5.4.9.bb | 3 +-
> 2 files changed, 26 insertions(+), 1 deletions(-)
> 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..b43a64e
> --- /dev/null
> +++ b/meta/recipes-devtools/rpm/rpm/rpm2cpio-fix-segmentation-fault.patch
> @@ -0,0 +1,24 @@
> +Upstream-Status: Pending
> +
> +rpm2cpio fails on target with "Segmentation fault". Because no "_dbpath"
> +defined, when query it will cause seg fault.
> +Parse macro files first to fix this bug.
> +
> +[YOCTO #3656]
> +
> +Signed-off-by: Kang Kai <kai.kang at windriver.com>
> +
> +--- rpm-5.4.9/tools/rpm2cpio.c.orig 2013-02-28 13:14:12.453540767 +0800
> ++++ rpm-5.4.9/tools/rpm2cpio.c 2013-02-28 15:09:41.685785192 +0800
> +@@ -88,6 +88,11 @@ int main(int argc, char **argv)
> + (void) rpmtsSetVSFlags(ts, vsflags);
> +
> + /*@-mustmod@*/ /* LCL: segfault */
> ++ rc = rpmReadConfigFiles(NULL, NULL);
> ++ if (rc) {
> ++ fprintf(stderr, _("read RPM config files failed\n"));
> ++ exit(EXIT_FAILURE);
> ++ }
> + rc = rpmReadPackageFile(ts, fdi, "rpm2cpio", &h);
> + /*@=mustmod@*/
> +
In the RPM2CPIO case, I'm not sure that we want to exit here. It's certainly
reasonable for the config files to be unavailable to us.
If the problem is that _dbpath is undefined (and it's needed for some reason),
my suggestion is that "some value" be defined, even if it's to a non-existent
location. It's be even better if we could simply avoid using the _dbpath at all
in the rpm2cpio code.
(Note, to folks reading this. Normally in oe-core, if we use rpm2cpio, we're
actually using a shell script version which does not have this problem. The
rpm2cpio -binary- is used by people on the target or sometimes via the SDK to
extract SRPM or RPM packages...)
> diff --git a/meta/recipes-devtools/rpm/rpm_5.4.9.bb b/meta/recipes-devtools/rpm/rpm_5.4.9.bb
> index 39b0481..fcfbde8 100644
> --- a/meta/recipes-devtools/rpm/rpm_5.4.9.bb
> +++ b/meta/recipes-devtools/rpm/rpm_5.4.9.bb
> @@ -43,7 +43,7 @@ LICENSE = "LGPLv2.1"
> LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1"
>
> DEPENDS = "libpcre attr acl popt ossp-uuid file bison-native"
> -PR = "r61"
> +PR = "r62"
>
> # rpm2cpio is a shell script, which is part of the rpm src.rpm. It is needed
> # in order to extract the distribution SRPM into a format we can extract...
> @@ -85,6 +85,7 @@ SRC_URI = "http://www.rpm5.org/files/rpm/rpm-5.4/rpm-5.4.9-0.20120508.src.rpm;ex
> file://rpm-reloc-macros.patch \
> file://rpm-platform2.patch \
> file://rpm-remove-sykcparse-decl.patch \
> + file://rpm2cpio-fix-segmentation-fault.patch \
> "
>
> # Uncomment the following line to enable platform score debugging
>
More information about the Openembedded-core
mailing list