RPM Community Forums

Mailing List Message of <rpm-devel>

FYI: DB 4.6 and absolute paths in region files

From: Ralf S. Engelschall <rse+rpm-devel@rpm5.org>
Date: Sun 29 Jul 2007 - 21:13:49 CEST
Message-ID: <20070729191348.GA9904@engelschall.com>
Just a heads up for those of you who create the RPM DB in a temporary
location (like DESTDIR) before installing it into the final run-time
location: seems like in DB 4.6 the region files (sometimes) contain the
absolute(!) path to the corresponding regular files and RPM outputs
a rather confusing error message, too. As a consequence one cannot
just use "rpm --initdb --dbpath /somewhere" and copy over _all_ files.
Starting with DB 4.6 one really _has_ to skip the region files. Test
case is following:

| $ /tmp/rpm/bin/rpm --initdb --dbpath /tmp/db
| $ ls -l /tmp/db/
| total 88
| -rw-r--r--  1 rse  rse     8192 Jul 29 21:07 Packages
| -rw-r--r--  1 rse  rse    24576 Jul 29 21:07 __db.001
| -rw-r--r--  1 rse  rse    57344 Jul 29 21:07 __db.002
| -rw-r--r--  1 rse  rse  1318912 Jul 29 21:07 __db.003
| -rw-r--r--  1 rse  rse   475136 Jul 29 21:07 __db.004
| $ strings -f /tmp/db/* |grep /tmp
| /tmp/db/__db.003: /tmp/db/Packages
                    ^^^^^^^
| $ mv /tmp/db/* /tmp/rpm/var/rpm/db/
| $ /tmp/rpm/bin/rpm -qa
| error: cannot open Packages index using db3 - No such file or directory (2)
| error: cannot open Packages database in /tmp/rpm/var/rpm/db
                     ^^^^^^^^             ^^^^^^^^^^^^^^^^^^^
| $ ls -l /tmp/rpm/var/rpm/db/Packages
| -rw-r--r--  1 rse  rse  8192 Jul 29 21:07 /tmp/rpm/var/rpm/db/Packages
| $ truss /tmp/rpm/bin/rpm -qa 2>&1 | grep "open(" | tail -1
| open("/tmp/db/Packages",O_RDONLY,00)             ERR#2 'No such file or directory'

Notice that the region file __db.003 contains the abolute path to
the "Packages" file and also notice the confusing error message: the
"Packages" which is not found here is really existing under the location
which is shown. The problem is that "Packages" no longer can be found
under original path.

So, notice: if you create an initial RPM DB in a temporary location
before you move it into place (as e.g. we are doing it under
$RPM_BUILD_ROOT in our "openpkg" package which contains RPM), you _have_
to skip the region files or you will be faced with the above error...

                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com
Received on Sun Jul 29 21:14:04 2007
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.