On Jun 11, 2012, at 2:55 AM, Rajasekhar wrote:

> Problem :
> 
> Unable to install the kernel rpm  when we are trying to install the
> rpm via our customized backend library .
> This case is observed when we have two kernels already installed and
> we are trying to install the third kernel
> 
> Description :
> 
> We have a backend library through which we are calling the rpm api's
> to install/upgrade the rpm's .
> When we are trying to install the kernel rpm's using our backend
> library we are getting the exceptions in the rpm library and our
> library is crashing .
> 
> Up on running the gdb the following trace is obtained .
> 
> #0  0x0000003a4f417052 in indexCmp (avp=0x7fffffffe020,
> bvp=0x3df16ee538) at header.c:186
> #1  0x0000003a4a834260 in bsearch () from /lib64/libc.so.6
> #2  0x0000003a4f417816 in findEntry (h=0x10315d0, tag=RPMTAG_EPOCH,
> type=RPM_NULL_TYPE) at header.c:708

Hmmm … RPM_NULL_TYPE has never been used in RPM afaik.
Offhand I'd guess that this SHOULD have been RPM_INT32_TYPE
(unchecked: just a wild guess, there may be other explanations …)

> #3  0x0000003a4f419be3 in intGetTdEntry (h=0x10315d0,
> td=0x7fffffffe130, flags=HEADERGET_DEFAULT) at header.c:1304
> #4  0x0000003a4f4175bb in headerGet (h=0x10315d0, tag=RPMTAG_EPOCH,
> td=0x7fffffffe130, flags=HEADERGET_DEFAULT) at header.c:1341
> #5  0x00007ffff7ddbc04 in headerGetEntryWrapper () from
> /opt/novell/zenworks/lib/zmd/libredcarpet.so.0
> #6  0x00007ffff7ddcb42 in rc_rpmman_read_header () from
> /opt/novell/zenworks/lib/zmd/libredcarpet.so.0
> #7  0x00007ffff7ddf469 in ?? () from
> /opt/novell/zenworks/lib/zmd/libredcarpet.so.0
> #8  0x00007ffff7de1202 in ?? () from
> /opt/novell/zenworks/lib/zmd/libredcarpet.so.0
> 
> 
> as we can observe in the trace the exception is coming while reading
> the rpm headers . As part of installation we will be reading headers
> of a rpm using the headerGet call from rpm library and when we are
> trying to read the header information(epoch tag) the application is
> getting crashed.
> 
> We are setting the following flags during the rpm transaction
>    1)RPMPROB_FILTER_REPLACEPKG
>    2)RPMPROB_FILTER_REPLACEOLDFILES
>    3)RPMPROB_FILTER_REPLACENEWFILES
>    4)RPMPROB_FILTER_OLDPACKAGE
> 
> 
> As we have limited knowledge on the rpm internals any help would be
> appreciated . The backend library source is located at
> http://download.opensuse.org/repositories/systemsmanagement:/zlm:/backend3/RedHat_RHEL-6/src/
> if some one wants to take a look at it .
> Let me know if you need any more details.

Note that the proper place to ask this question is likely OpenSUSE because
its their libredcarpet and extensive set of patches to RPM (and this is 
@rpm5.org
which is a different code base than SuSE uses).

Red Carpet has also traditionally tried to dlopen(3) RPM libraries
for version "portability": is that still the case?

Meanwhile if you can supply:
        1) the exact version of RPM in use.
        2) valgrind output (see below) with -v -v output enabled
I can probably tell you what is wrong (or at least narrow
down the possibilities and describe what to do next …)

The usual problem with header segfaults is a missing reference count on the 
header
somewhere. That guess can be confirmed by making a headerLink() call somewhere
to see if the segfault disappears (but you will then have a (usually easier to 
solve)
memory leak problem using valgrind).

This is the usual way I invoke valgrind:

        valgrind -v --tool=memcheck --leak-check=full --show-reachable=yes 
--track-origins=yes \
                <whatever_command_you_want_to_debug>

Please try to also get -v -v (as on the rpm CLI) enabled because that helps
provide context for analyzing the valgrind errors.

hth

73 de Jeff

______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
Developer Communication List                        rpm-devel@rpm5.org

Reply via email to