RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm-5_1: rpm/ CHANGES rpm/lib/ depends.c rpmfi.c rpmfi.h

From: Jeff Johnson <jbj@rpm5.org>
Date: Thu 19 Aug 2010 - 18:32:52 CEST
Message-Id: <20100819163252.4CAD9D25DB@rpm5.org>
  RPM Package Manager, CVS Repository
  /cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   19-Aug-2010 18:32:52
  Branch: rpm-5_1                          Handle: 2010081916325001

  Modified files:           (Branch: rpm-5_1)
    rpm                     CHANGES
    rpm/lib                 depends.c rpmfi.c rpmfi.h

  Log:
    - solve: use rpmbf to filter narcisstic path dependencies.

  Summary:
    Revision    Changes     Path
    1.2288.2.319+1  -0      rpm/CHANGES
    1.394.2.24  +11 -1      rpm/lib/depends.c
    2.123.2.14  +42 -1      rpm/lib/rpmfi.c
    2.54.2.15   +11 -0      rpm/lib/rpmfi.h
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2288.2.318 -r1.2288.2.319 CHANGES
  --- rpm/CHANGES	19 Aug 2010 16:27:00 -0000	1.2288.2.318
  +++ rpm/CHANGES	19 Aug 2010 16:32:50 -0000	1.2288.2.319
  @@ -1,4 +1,5 @@
   5.1.9 -> 5.1.10:
  +    - jbj: solve: use rpmbf to filter narcisstic path dependencies.
       - jbj: rpmbf: backport from HEAD.
       - jbj: solve: commit to a test framework based on EDOS and Poky.
       - jbj: solve: use RPMTAG_PACKAGEORIGIN paths when available.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/depends.c
  ============================================================================
  $ cvs diff -u -r1.394.2.23 -r1.394.2.24 depends.c
  --- rpm/lib/depends.c	5 Apr 2009 18:03:08 -0000	1.394.2.23
  +++ rpm/lib/depends.c	19 Aug 2010 16:32:51 -0000	1.394.2.24
  @@ -5,6 +5,7 @@
   #include "system.h"
   
   #include <rpmio.h>
  +#include <rpmbf.h>
   #define	_RPMTE_INTERNAL
   #define	_RPMTS_INTERNAL
   #include <rpmcli.h>		/* XXX rpmcliPackagesTotal */
  @@ -2083,6 +2084,7 @@
       rpmtsi qi; rpmte q;
       tsortInfo tsi;
       nsType NSType = rpmdsNSType(requires);
  +    const char * N = rpmdsN(requires);
       fnpyKey key;
       int teType = rpmteType(p);
       alKey pkgKey;
  @@ -2116,6 +2118,14 @@
   	break;
       }
   
  +    /* Avoid looking up files/directories that are "owned" by _THIS_ package. */
  +    if (*N == '/') {
  +	rpmfi fi = rpmteFI(p, RPMTAG_BASENAMES); 
  +	rpmbf bf = rpmfiBloomFN(fi);
  +	if (bf != NULL && rpmbfChk(bf, N, strlen(N)) > 0)
  +	    return 0;
  +    }                   
  +
       pkgKey = RPMAL_NOMATCH;
       key = rpmalSatisfiesDepend(al, requires, &pkgKey);
   
  @@ -2257,7 +2267,7 @@
   #define isAuto(_x)	((_x) & _autobits)
   
   /*@unchecked@*/
  -static int slashDepth = 100;	/* #slashes pemitted in parentdir deps. */
  +static int slashDepth = 0;	/* #slashes pemitted in parentdir deps. */
   
   static int countSlashes(const char * dn)
   	/*@*/
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmfi.c
  ============================================================================
  $ cvs diff -u -r2.123.2.13 -r2.123.2.14 rpmfi.c
  --- rpm/lib/rpmfi.c	5 Apr 2009 18:03:08 -0000	2.123.2.13
  +++ rpm/lib/rpmfi.c	19 Aug 2010 16:32:51 -0000	2.123.2.14
  @@ -6,10 +6,11 @@
   #include "system.h"
   
   #include <rpmio.h>
  -#include <ugid.h>
  +#include <rpmbf.h>
   #include <rpmcb.h>		/* XXX fnpyKey */
   #include <rpmurl.h>	/* XXX urlGetPath */
   #include <mire.h>
  +#include <ugid.h>
   
   #define	_RPMAV_INTERNAL	/* XXX avOpendir */
   #include <rpmdav.h>
  @@ -163,6 +164,37 @@
       return FN;
   }
   
  +void * rpmfiFNBF(rpmfi fi)
  +{
  +    void * _fnbf = NULL;
  +    if (fi != NULL) {
  +	if (fi->_fnbf == NULL) {
  +	    char * fn = alloca(fi->fnlen + 1);
  +	    static double e = 1.0e-6;
  +	    size_t n = (fi->fc > 256 ? fi->fc : 256); /* XXX necessary? */
  +	    size_t m = 0;
  +	    size_t k = 0;
  +	    rpmbf bf;
  +	    int i;
  +
  +	    rpmbfParams(n, e, &m, &k);
  +	    bf = rpmbfNew(m, k, 0);
  +	    for (i = 0; i < (int)fi->fc; i++) {
  +		const char * dn;
  +		int xx;
  +		dn = NULL;
  +		(void) urlPath(fi->dnl[fi->dil[i]], &dn);
  +		dn = stpcpy(stpcpy(fn, dn), fi->bnl[i]);
  +		xx = rpmbfAdd(bf, fn, (size_t)(dn - fn));
  +assert(xx == 0);
  +	    }
  +	    fi->_fnbf = bf;
  +	}
  +	_fnbf = fi->_fnbf;
  +    }
  +    return _fnbf;
  +}
  +
   uint32_t rpmfiFFlags(rpmfi fi)
   {
       uint32_t FFlags = 0;
  @@ -428,6 +460,14 @@
       return fgroup;
   }
   
  +
  +void * rpmfiBloomFN(const rpmfi fi)
  +{
  +/*@-assignexpose -retexpose @*/
  +    return (fi != NULL ? fi->_fnbf : NULL);
  +/*@=assignexpose =retexpose @*/
  +}
  +
   void * rpmfiExclude(const rpmfi fi)
   {
       return (fi != NULL ? fi->exclude : NULL);
  @@ -1252,6 +1292,7 @@
   
       fi->fsm = freeFSM(fi->fsm);
   
  +    fi->_fnbf = rpmbfFree((rpmbf)fi->_fnbf);
       fi->exclude = mireFreeAll(fi->exclude, fi->nexclude);
       fi->include = mireFreeAll(fi->include, fi->ninclude);
   
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/rpmfi.h
  ============================================================================
  $ cvs diff -u -r2.54.2.14 -r2.54.2.15 rpmfi.h
  --- rpm/lib/rpmfi.h	5 Apr 2009 18:03:08 -0000	2.54.2.14
  +++ rpm/lib/rpmfi.h	19 Aug 2010 16:32:51 -0000	2.54.2.15
  @@ -166,6 +166,8 @@
   /*@dependent@*/ /*@relnull@*/
       void * te;
   
  +/*@only@*/
  +    void * _fnbf;		/*!< File paths Bloom filter. */
   /*@only@*/ /*@null@*/
       miRE exclude;		/*!< Iterator exclude patterns. */
       int nexclude;		/*!< No. of exclude patterns. */
  @@ -585,6 +587,15 @@
   	/*@*/;
   
   /**
  + * Return FN Bloom filter from file info set.
  + * @param fi		file info set
  + * @return		FN Bloom filter, NULL on invalid
  + */
  +/*@null@*/
  +void * rpmfiFNBF(rpmfi fi)
  +	/*@*/;
  +
  +/**
    * Return next file iterator index.
    * @param fi		file info set
    * @return		file iterator index, -1 on termination
  @@ .
Received on Thu Aug 19 18:32:52 2010
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.