[Bug 347749] Re: "rpm -i ldconfig" removes setup

Patryk Zawadzki patrys at pld-linux.org
Thu Jun 4 18:23:00 CEST 2009


What we dicovered in rpm:

lib/psm.c, rpmpsmStage @ 1643:

  hdrid = rpmteHdrid(psm->te);
  psm->mi = rpmtsInitIterator(ts, RPMTAG_SHA1HEADER, hdrid, 0);

This initiates a search for earlier installation of the very same
package. In theory it should only find the exact NEVRA in case where
reinstall was required.

lib/psm.c, rpmpsmStage @ 1660:

  while ((psm->oh = rpmdbNextIterator(psm->mi)) != NULL) {
    fi->record = rpmdbGetIteratorOffset(psm->mi);
    psm->oh = NULL;
    break;
  }

This consumes the iterator from above and checks if there was a match.
It then takes the first match and remembers it in fi->record.

lib/psm.c, rpmpsmStage @ 2075:

  if (fi->record && !(rpmtsFlags(ts) & RPMTRANS_FLAG_APPLYONLY)) {
    rc = rpmpsmNext(psm, PSM_RPMDB_REMOVE);
    if (rc) break;
  }

This checks if fi->record contains any matches and if so, forces their
removal from DB, assuming the header will be readded during the same
transaction (if a match was found, we are reinstalling the same package,
remember?).

Now what is completely weird is that the search in the first step tends
to return completely random results. Like glibc header matching ncurses.
This causes random bugs where installing one package will silently
remove another package from rpmdb.

At first we though it was some sort of SHA1 substring collision but it
seems to happen with completely random data.

glen should be able to give precise versions of db4.7 and rpm4.5 we used
for testing.

-- 
"rpm -i ldconfig" removes setup
https://bugs.launchpad.net/bugs/347749
You received this bug notification because you are subscribed to PLD
Linux.

Status in PLD Linux Distribution: New

Bug description:
On some PLD installations installing some packages removes other ones from rpm database. Poldek reinstalls such packages on each upgrade.

It is the simplest test case:
my environment: th-test/i686, rpm-4.5-13.i686 and rpm-4.5-14.i686
one of PLD users (PawelK) has reported similar bug on ti/x86_64: http://www.mail-archive.com/pld-users-pl@lists.pld-linux.org/msg21777.html

--------- install FHS and setup in empty chroot ---------
# rpm --root=/root/test -ivh FHS-2.3-23.i686.rpm setup-2.6.2-2.i686.rpm                                                                               
# rpm --root=/root/test -qa                                              
FHS-2.3-23.i686
setup-2.6.2-2.i686
--------- now install ldconfig ---------
# rpm --root=/root/test -i ldconfig-2.9-6.i686.rpm
# rpm --root=/root/test -qa                         
FHS-2.3-23.i686
ldconfig-2.9-6.i686
# file /root/test/sbin/joinpasswd
/root/test/sbin/joinpasswd: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped
--------- so setup is NOT registered by rpm database but  it has not been uninstalled---------

I have attached console log with full rpm debug. (note "D: removing "setup" from Name index." line)

some observations:
* It happens with different packages. On my laptop it happens with coreutils - it is reinstalled on each upgrade. PawelK reported the same problem with coreutils and login.
* I'm sure that packages using for test was correct. I have downloaded them directly from ftp.
* I have tested it with rpm-4.5-13 and rpm-4.5-14. PawelK tested id with rpm-4.5-12.
* I tried to create directory, rpm --initdb i that directory, then copy this empty chroot and FHS, setup, ldconfig rpms to another machine. On that machine everything was ok. It means that rpm --initdb works corectly.
* I tried to install FHS and setup on my workstation, then copy chroot and ldconfig.rpm on another machine, and then install ldconfig. Still everything is ok. So something is wrong with rpm -ivh ldconfig on my workstation.


More information about the pld-bugs mailing list