I disabled the rpmdsFree in the previous chunk of code, and now showrc works as
expected.

In lib/rpmrc.c

@@ -1216,11 +1229,15 @@
                if (DNEVR != NULL)
                    fprintf(fp, "    %s\n", DNEVR+2);
            }
+#if 0
            (void)rpmdsFree(ds);
            ds = NULL;
+#endif
            fprintf(fp, "\n");
        }
+#if 0
        PRCO = rpmdsFreePRCO(PRCO);
+#endif
     }

     if (rpmIsVerbose()) {

> I'm currently using rpm-5.4.0, and I've encountered a few issues.. however
> during this I'm trying to diagnose loading of certain files using --showrc.  
> But
> when I do, I get a segfault.
> 
> Looking at valgrind output I get:
> 
> ==3492== Invalid read of size 8
> ==3492==    at 0x53E862A: rpmioGetPool (rpmmalloc.c:223)
> ==3492==    by 0x4E73A9B: rpmdsGetPool (rpmds.c:196)
> ==3492==    by 0x4E76209: rpmdsMerge (rpmds.c:950)
> ==3492==    by 0x4E782B2: rpmdsRpmlib (rpmds.c:1567)
> ==3492==    by 0x4E88966: rpmShowRC (rpmrc.c:1243)
> 
> And further items that seem to indicate I've got memory corruption.
> 
>     if (rpmIsVerbose()) {
>         fprintf(fp, _("Features provided by rpmlib installer:\n"));
>         xx = rpmdsRpmlib(&ds, NULL);

Within rpmdsRpmlib, it does a merge of ds & the new internal ds from the rpmlib
instantiation.  This is what is triggering the valgrind messages, but again I'm
at a loss to figure out where the real bug is.. but based on the above it seems
like it's in the merge code.

--Mark

>         ds = rpmdsInit(ds);
>         while (rpmdsNext(ds) >= 0) {
> 
> the rpmdsRpmlib is the function causing the issue.  Prior to this ds is freed,
> and I'm wondering if that is causing the problem.  But I'm not sure how to
> diagnose any of the memory pool functions or even if Merge is doing the right
> thing.  Any suggestions would be appreciated.
> 
> --Mark
______________________________________________________________________
RPM Package Manager                                    http://rpm5.org
Developer Communication List                        rpm-devel@rpm5.org

Reply via email to