Hmmm ... rpmmiCount is supposed to be invoked lazily when needed,
not as part of every iteration.

The conditions in rpmmiCount() may need adjustment. That I can
easily believe.

But an extra dbiGet() and dbiCount() call introduced into
rpmmiNext() is almost certainly neither the right fix,
nor the right place to fix whatever.

What exactly is motivating this change? If its
%trigger* handling to replace Mandriva file triggers,
then I most definitely want to see this under
        #ifdef RPM_VENDOR_MANDRIVA
until there's time for test cases and investigation.

73 de Jeff

On Feb 13, 2011, at 8:57 PM, Per Øyvind Karlsen wrote:

>  RPM Package Manager, CVS Repository
>  http://rpm5.org/cvs/
>  ____________________________________________________________________________
> 
>  Server: rpm5.org                         Name:   Per Øyvind Karlsen
>  Root:   /v/rpm/cvs                       Email:  pkarl...@rpm5.org
>  Module: rpm                              Date:   14-Feb-2011 02:57:48
>  Branch: rpm-5_3                          Handle: 2011021401574701
> 
>  Modified files:           (Branch: rpm-5_3)
>    rpm                     CHANGES
>    rpm/rpmdb               rpmdb.c
> 
>  Log:
>    set mi->mi_count when rpmmiNext() initializes db cursor so that
>    rpmmiCount() won't break (mdvbz#62267)
> 
>  Summary:
>    Revision    Changes     Path
>    1.3296.2.160+2  -0      rpm/CHANGES
>    1.386.2.9   +3  -0      rpm/rpmdb/rpmdb.c
>  ____________________________________________________________________________
> 
>  patch -p0 <<'@@ .'
>  Index: rpm/CHANGES
>  ============================================================================
>  $ cvs diff -u -r1.3296.2.159 -r1.3296.2.160 CHANGES
>  --- rpm/CHANGES      12 Feb 2011 23:12:49 -0000      1.3296.2.159
>  +++ rpm/CHANGES      14 Feb 2011 01:57:47 -0000      1.3296.2.160
>  @@ -1,4 +1,6 @@
>   5.3.8 -> 5.3.9:
>  +    - proyvind: set mi->mi_count when rpmmiNext() initializes db cursor so 
> that
>  +    rpmmiCount() won't break (mdvbz#62267)
>       - proyvind: fix rpmmiCount() not resetting db cursor after use, breaking
>       iterator (mdvbz#62279)
> 
>  @@ .
>  patch -p0 <<'@@ .'
>  Index: rpm/rpmdb/rpmdb.c
>  ============================================================================
>  $ cvs diff -u -r1.386.2.8 -r1.386.2.9 rpmdb.c
>  --- rpm/rpmdb/rpmdb.c        12 Feb 2011 23:12:49 -0000      1.386.2.8
>  +++ rpm/rpmdb/rpmdb.c        14 Feb 2011 01:57:48 -0000      1.386.2.9
>  @@ -2154,6 +2154,9 @@
>   if (k.data && k.size == 0) k.size = (UINT32_T) strlen((char *)k.data);
>   if (k.data && k.size == 0) k.size++;        /* XXX "/" fixup. */
>       _flags = DB_SET;
>  +    if (!dbiGet(dbi, mi->mi_dbc, &k, &v, _flags))
>  +        xx = dbiCount(dbi, mi->mi_dbc, &mi->mi_count, 0);
>  +
>       } else
>       _flags = (mi->mi_setx ? DB_NEXT_DUP : DB_SET);
> 
>  @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org
> CVS Sources Repository                                rpm-...@rpm5.org

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to