* [PATCH 0/1] Fix YOCTO #3656 @ 2013-09-30 9:48 Kai Kang 2013-09-30 9:48 ` [PATCH 1/1] rpm: fix rpm2cpio segmentation fault Kai Kang 0 siblings, 1 reply; 9+ messages in thread From: Kai Kang @ 2013-09-30 9:48 UTC (permalink / raw) To: mark.hatle; +Cc: openembedded-core The following changes since commit b049d532f6e0ab9e458e486f81b00be47ee69acf: testimage: Exclude BB_ORIGENV variable (2013-09-26 17:27:02 +0100) are available in the git repository at: git://git.pokylinux.org/poky-contrib kangkai/rpm2cpio http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/rpm2cpio Kang Kai (1): rpm: fix rpm2cpio segmentation fault .../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 -- 1.8.1.2 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/1] rpm: fix rpm2cpio segmentation fault 2013-09-30 9:48 [PATCH 0/1] Fix YOCTO #3656 Kai Kang @ 2013-09-30 9:48 ` Kai Kang 2013-09-30 14:02 ` Mark Hatle 0 siblings, 1 reply; 9+ messages in thread From: Kai Kang @ 2013-09-30 9:48 UTC (permalink / raw) To: mark.hatle; +Cc: openembedded-core From: Kang Kai <kai.kang@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@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@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 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] rpm: fix rpm2cpio segmentation fault 2013-09-30 9:48 ` [PATCH 1/1] rpm: fix rpm2cpio segmentation fault Kai Kang @ 2013-09-30 14:02 ` Mark Hatle 0 siblings, 0 replies; 9+ messages in thread From: Mark Hatle @ 2013-09-30 14:02 UTC (permalink / raw) To: Kai Kang; +Cc: openembedded-core On 9/30/13 4:48 AM, Kai Kang wrote: > From: Kang Kai <kai.kang@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. I talked briefly with the RPM maintainer about this a while back. I don't think this is the right patch. Not because what it does is wrong. (The patch itself is actually likely correct in the general case.) However, the proper fix is to simply use the rpm2cpio shell script, and never install the binary. (This does introduce a dependency on 'file', but I don't believe that should be a major concern.) So my suggestion is to rework this fix by: 1) Keep what you have below (why? because if someone really wants the binary it'll prevent the segfault.) 2) Change the recipe's do_install to copy in the rpm2cpio.sh and replace the binary version. 3) Ensure that the package that rpm2cpio is in gets a dependency on 'file'. --Mark > [YOCTO #3656] > > Signed-off-by: Kang Kai <kai.kang@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@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 > ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 0/1] V2: Fix rpm2cpio segment fault @ 2013-04-15 3:17 Kang Kai 2013-04-15 3:17 ` [PATCH 1/1] rpm: fix rpm2cpio segmentation fault Kang Kai 0 siblings, 1 reply; 9+ messages in thread From: Kang Kai @ 2013-04-15 3:17 UTC (permalink / raw) To: mark.hatle; +Cc: openembedded-core Hi Mark, As my last mail on Apr 12 mentioned, not only macro "_dbpath" need to be defined. Macros "_dbi_config*" are needed too, and they can't be simply assigned some value. I think parse config files first could be a workaround to fix rpm2cpio segment fault error for now. Thanks, Kai The following changes since commit 4c02dd5f6432c6e683a57d47b610f56433e9ca0d: kern-tools: fix conditional configuration items (2013-04-11 08:27:41 +0100) are available in the git repository at: git://git.pokylinux.org/poky-contrib kangkai/rpm2cpio-segfault http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/rpm2cpio-segfault Kang Kai (1): rpm: fix rpm2cpio segmentation fault .../rpm/rpm/rpm2cpio-fix-segmentation-fault.patch | 28 ++++++++++++++++++++ meta/recipes-devtools/rpm/rpm_5.4.9.bb | 1 + 2 files changed, 29 insertions(+), 0 deletions(-) create mode 100644 meta/recipes-devtools/rpm/rpm/rpm2cpio-fix-segmentation-fault.patch -- 1.7.5.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/1] rpm: fix rpm2cpio segmentation fault 2013-04-15 3:17 [PATCH 0/1] V2: Fix rpm2cpio segment fault Kang Kai @ 2013-04-15 3:17 ` Kang Kai 0 siblings, 0 replies; 9+ messages in thread From: Kang Kai @ 2013-04-15 3:17 UTC (permalink / raw) To: mark.hatle; +Cc: openembedded-core 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@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(+), 0 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..a99769a --- /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@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 7d2cba4..1defc78 100644 --- a/meta/recipes-devtools/rpm/rpm_5.4.9.bb +++ b/meta/recipes-devtools/rpm/rpm_5.4.9.bb @@ -86,6 +86,7 @@ SRC_URI = "http://www.rpm5.org/files/rpm/rpm-5.4/rpm-5.4.9-0.20120508.src.rpm;ex file://rpm-platform2.patch \ file://rpm-remove-sykcparse-decl.patch \ file://debugedit-segv.patch \ + file://rpm2cpio-fix-segmentation-fault.patch \ " # Uncomment the following line to enable platform score debugging -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 0/1] Fix rpm2cpio segment fault @ 2013-02-28 7:34 Kang Kai 2013-02-28 7:34 ` [PATCH 1/1] rpm: fix rpm2cpio segmentation fault Kang Kai 0 siblings, 1 reply; 9+ messages in thread From: Kang Kai @ 2013-02-28 7:34 UTC (permalink / raw) To: openembedded-core; +Cc: Zhenfeng.Zhao The following changes since commit d7b248e715d99766bf8602ff9f038f8b0afa5e78: augeas: change SRC_URI (2013-02-26 08:02:29 -0800) are available in the git repository at: git://git.pokylinux.org/poky-contrib kangkai/fix-rpm2cpio http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=kangkai/fix-rpm2cpio Kang Kai (1): rpm: fix rpm2cpio segmentation fault .../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 -- 1.7.5.4 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/1] rpm: fix rpm2cpio segmentation fault 2013-02-28 7:34 [PATCH 0/1] Fix rpm2cpio segment fault Kang Kai @ 2013-02-28 7:34 ` Kang Kai 2013-02-28 14:34 ` Mark Hatle 0 siblings, 1 reply; 9+ messages in thread From: Kang Kai @ 2013-02-28 7:34 UTC (permalink / raw) To: openembedded-core; +Cc: Zhenfeng.Zhao 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@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@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@*/ + 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 -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] rpm: fix rpm2cpio segmentation fault 2013-02-28 7:34 ` [PATCH 1/1] rpm: fix rpm2cpio segmentation fault Kang Kai @ 2013-02-28 14:34 ` Mark Hatle 2013-03-12 5:57 ` Kang Kai 0 siblings, 1 reply; 9+ messages in thread From: Mark Hatle @ 2013-02-28 14:34 UTC (permalink / raw) To: openembedded-core 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@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@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 > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] rpm: fix rpm2cpio segmentation fault 2013-02-28 14:34 ` Mark Hatle @ 2013-03-12 5:57 ` Kang Kai 2013-03-12 15:30 ` Mark Hatle 0 siblings, 1 reply; 9+ messages in thread From: Kang Kai @ 2013-03-12 5:57 UTC (permalink / raw) To: Mark Hatle; +Cc: openembedded-core On 2013年02月28日 22:34, Mark Hatle wrote: > 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@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@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@*/ >> + > Hi Mark, Sorry for missed this mail. > 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. How about just give warning without quit when read configure files fails? > > 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. The segment fault occurs on executing rpmReadPackageFile(). It is a library function in rpmdb/package.c. And it finally calls rpmdbNew(), and in rpmdbNew() it calls: db->db_home = rpmdbURIPath( (home && *home ? home : _DB_HOME) ); home passed in is NULL, and _DB_HOME is defined by: #define _DB_HOME "%{?_dbpath}" Then segment fault occurs with xstrdup() because no value is definedfor _dbpath then it tries to xstrdup() a NULL value in rpmdbURIPath(). That is why I think parse configure files first in rpm2cpio is the way to fix the issue. Regards, Kai > > (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 >> > > > _______________________________________________ > Openembedded-core mailing list > Openembedded-core@lists.openembedded.org > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] rpm: fix rpm2cpio segmentation fault 2013-03-12 5:57 ` Kang Kai @ 2013-03-12 15:30 ` Mark Hatle 2013-04-12 9:18 ` Kang Kai 0 siblings, 1 reply; 9+ messages in thread From: Mark Hatle @ 2013-03-12 15:30 UTC (permalink / raw) To: Kang Kai; +Cc: openembedded-core On 3/12/13 12:57 AM, Kang Kai wrote: > On 2013年02月28日 22:34, Mark Hatle wrote: >> 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@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@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@*/ >>> + >> > > Hi Mark, > > Sorry for missed this mail. > >> 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. > > How about just give warning without quit when read configure files fails? We shouldn't even need a warning. When rpm2cpio is used on a target, much of the time there is no associated RPM in use (or if it's available, there likely isn't a database/home configured.) >> >> 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. > > The segment fault occurs on executing rpmReadPackageFile(). It is a > library function in rpmdb/package.c. And it finally calls rpmdbNew(), > and in rpmdbNew() it calls: > > db->db_home = rpmdbURIPath( (home && *home ? home : _DB_HOME) ); > > home passed in is NULL, and _DB_HOME is defined by: > > #define _DB_HOME "%{?_dbpath}" Instead of a warning above, if we were unable to load the database configuration, can we just set the value of _dbpath to be "/tmp"? This should provide a valid 'home' path for any temp files, as well as avoid any load problems. If there is a configuration available, we can use it. > Then segment fault occurs with xstrdup() because no value is definedfor > _dbpath then it tries to xstrdup() a NULL value in rpmdbURIPath(). > > That is why I think parse configure files first in rpm2cpio is the way > to fix the issue. > > Regards, > Kai > >> >> (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 >>> >> >> >> _______________________________________________ >> Openembedded-core mailing list >> Openembedded-core@lists.openembedded.org >> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core >> > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/1] rpm: fix rpm2cpio segmentation fault 2013-03-12 15:30 ` Mark Hatle @ 2013-04-12 9:18 ` Kang Kai 0 siblings, 0 replies; 9+ messages in thread From: Kang Kai @ 2013-04-12 9:18 UTC (permalink / raw) To: Mark Hatle; +Cc: openembedded-core On 2013年03月12日 23:30, Mark Hatle wrote: > On 3/12/13 12:57 AM, Kang Kai wrote: >> On 2013年02月28日 22:34, Mark Hatle wrote: >>> 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@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@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@*/ >>>> + >>> >> >> Hi Mark, >> >> Sorry for missed this mail. >> >>> 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. >> >> How about just give warning without quit when read configure files >> fails? > > We shouldn't even need a warning. When rpm2cpio is used on a target, > much of the time there is no associated RPM in use (or if it's > available, there likely isn't a database/home configured.) > >>> >>> 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. >> >> The segment fault occurs on executing rpmReadPackageFile(). It is a >> library function in rpmdb/package.c. And it finally calls rpmdbNew(), >> and in rpmdbNew() it calls: >> >> db->db_home = rpmdbURIPath( (home && *home ? home : _DB_HOME) ); >> >> home passed in is NULL, and _DB_HOME is defined by: >> >> #define _DB_HOME "%{?_dbpath}" > Hi Mark, > Instead of a warning above, if we were unable to load the database > configuration, can we just set the value of _dbpath to be "/tmp"? > This should provide a valid 'home' path for any temp files, as well as > avoid any load problems. If there is a configuration available, we > can use it. More vars found need to be set with a value. When run rpm2cpio, it calls rpmReadPackageFile() to open the rpm file, and then do some read and test work. When call rpmVerifySignature() it calls rpmdbOpen() and finally calls db3new(). In function db3new() in rpmdb/dbconfig.c around line 485, vars "_dbi_config_*" are expanded and var "_dbi_config" is asserted not to be NULL. But without parsing the macros file, assertion fails. "_dbi_config" is a complicated var and seems can not be set directly. Would you like to give more help? Thanks, Kai > >> Then segment fault occurs with xstrdup() because no value is definedfor >> _dbpath then it tries to xstrdup() a NULL value in rpmdbURIPath(). >> >> That is why I think parse configure files first in rpm2cpio is the way >> to fix the issue. >> >> Regards, >> Kai >> >>> >>> (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 >>>> >>> >>> >>> _______________________________________________ >>> Openembedded-core mailing list >>> Openembedded-core@lists.openembedded.org >>> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core >>> >> > > -- Regards, Neil | Kai Kang ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-09-30 14:02 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-09-30 9:48 [PATCH 0/1] Fix YOCTO #3656 Kai Kang 2013-09-30 9:48 ` [PATCH 1/1] rpm: fix rpm2cpio segmentation fault Kai Kang 2013-09-30 14:02 ` Mark Hatle -- strict thread matches above, loose matches on Subject: below -- 2013-04-15 3:17 [PATCH 0/1] V2: Fix rpm2cpio segment fault Kang Kai 2013-04-15 3:17 ` [PATCH 1/1] rpm: fix rpm2cpio segmentation fault Kang Kai 2013-02-28 7:34 [PATCH 0/1] Fix rpm2cpio segment fault Kang Kai 2013-02-28 7:34 ` [PATCH 1/1] rpm: fix rpm2cpio segmentation fault Kang Kai 2013-02-28 14:34 ` Mark Hatle 2013-03-12 5:57 ` Kang Kai 2013-03-12 15:30 ` Mark Hatle 2013-04-12 9:18 ` Kang Kai
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox