RPM Community Forums

Mailing List Message of <rpm-devel>

Conflicts on files not symmetric

From: Michael Schroeder <mls@suse.de>
Date: Fri 19 Sep 2008 - 11:07:04 CEST
Message-ID: <20080919090704.GA25215@suse.de>

Hi rpm-4 and rpm-5,

while implementing virtual triggers I stumbled over the fact
that conflicts on files only work in one direction. Example:

Package A contains /foo
Package B has "Conflicts: /foo"

If A is already installed and one tries to install B, a dependency
conflict is reported:
    error: Failed dependencies:
	    /foo conflicts with B-1-1.i586

If B is already installed and one tries to install A, no error
is displayed and the package is installed.

So, is this a known bug? Is it worth fixing?

If this needs fixing, here's an idea: As it probably costs too
much time to test each file in the file list for conflicts, how
about creating a index of the conflicts first and only test
the files that match the index?

I.e. add a function

char *rpmdbKeyIterator(rpmdbMatchIterator mi) {
    int rc, xx;
    dbiIndex dbi; 

    dbi = dbiOpen(mi->mi_db, mi->mi_rpmtag, 0);
    if (mi->mi_dbc == NULL)
        xx = dbiCopen(dbi, dbi->dbi_txnid, &mi->mi_dbc, mi->mi_cflags);
    rc = dbiGet(dbi, mi->mi_dbc, &mi->mi_key, &mi->mi_data, DB_NEXT);
    if (rc) 
        return 0;
    if (mi->mi_keyp)
        free((char *)mi->mi_keyp);
    mi->mi_keyp = (void *)xmalloc(mi->mi_key.size + 1);
    memcpy((char *)mi->mi_keyp, mi->mi_key.data, mi->mi_key.size);
    ((char *)mi->mi_keyp)[mi->mi_key.size] = 0; 
    mi->mi_keylen = mi->mi_key.size;
    return (char *)mi->mi_keyp;

to rpmdb.c, then use

    mi = rpmtsInitIterator(ts, RPMTAG_CONFLICTNAME, 0, 0);
    while ((key = rpmdbKeyIterator(mi)) != 0)

to create an array of basenames, sort it and then go through the
filelist and match only if bsearch for the basename returns true.



Michael Schroeder                                   mls@suse.de
SUSE LINUX Products GmbH, GF Markus Rex, HRB 16746 AG Nuernberg
Received on Fri Sep 19 11:19:31 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.