[Rpm-maint] [rpm-software-management/rpm] Failure to read rpmdb from CentOS 7.5.1804 with the bdb_ro backend (#1576)
Philippe Ombredanne
notifications at github.com
Thu Mar 11 18:37:20 UTC 2021
To reproduce, this base rootfs for Docker contains an rpmdb https://github.com/CentOS/sig-cloud-instance-images/blob/CentOS-7.5.1804/docker/centos-7-docker.tar.xz?raw=true
Then compile rpm with these [configure flags](https://github.com/nexB/scancode-plugins/blob/develop/builtins/rpm_inspector_rpm/build.sh) (I used rpm-4.16.1.2-release, but the latest head should have the same issue)
```
./autogen.sh \
--enable-static \
--disable-openmp \
--enable-bdb=no \
--enable-bdb-ro=yes \
--enable-ndb \
--enable-sqlite=yes \
--disable-plugins \
--without-lua \
--with-crypto=openssl
```
Then run this rpm command on the extracted rootfs:
```
rpm --query --all --verbose --verbose --dbpath <path to rootfs>/var/lib/rpm
D: Found bdb_ro Packages database: using bdb_ro backend.
D: opening db index <path to rootfs>/var/lib/rpm/Packages
D: opening db index <path to rootfs>/var/lib/rpm/Name
D: opening db index <path to rootfs>/var/lib/rpm/Basenames
D: opening db index <path to rootfs>/var/lib/rpm/Group
D: opening db index <path to rootfs>/var/lib/rpm/Requirename
D: opening db index <path to rootfs>/var/lib/rpm/Providename
D: opening db index <path to rootfs>/var/lib/rpm/Conflictname
D: opening db index <path to rootfs>/var/lib/rpm/Obsoletename
D: opening db index <path to rootfs>/var/lib/rpm/Triggername
D: opening db index <path to rootfs>/var/lib/rpm/Dirnames
D: opening db index <path to rootfs>/var/lib/rpm/Installtid
D: opening db index <path to rootfs>/var/lib/rpm/Sigmd5
D: opening db index <path to rootfs>/var/lib/rpm/Sha1header
D: opening db index <path to rootfs>/var/lib/rpm/Filetriggername
error: <path to rootfs>/var/lib/rpm/Filetriggername: pread: Bad file descriptor
error: could not open <path to rootfs>/var/lib/rpm/Filetriggername: Bad file descriptor
error: cannot open Filetriggername index using bdb_ro - Operation not permitted (1)
error: cannot open Packages database in <path to rootfs>/var/lib/rpm
```
Basically as pointed to by @Conan-Kudo this RPM was built with 4.11.3 and Filetriggername appeared circa 4.13
IMHO we should be able to read all rpmdb with bdb_ro that would have this file/magic:
```
$ file <path to rootfs>/var/lib/rpm/*
<path to rootfs>/var/lib/rpm/Basenames: Berkeley DB (Btree, version 9, native byte-order)
<path to rootfs>/var/lib/rpm/Conflictname: Berkeley DB (Btree, version 9, native byte-order)
<path to rootfs>/var/lib/rpm/__db.001: Applesoft BASIC program data, first line number 18
<path to rootfs>/var/lib/rpm/__db.002: a.out little-endian 32-bit pure executable
<path to rootfs>/var/lib/rpm/__db.003: a.out little-endian 32-bit pure executable not stripped
<path to rootfs>/var/lib/rpm/Dirnames: Berkeley DB (Btree, version 9, native byte-order)
<path to rootfs>/var/lib/rpm/Group: Berkeley DB (Btree, version 9, native byte-order)
<path to rootfs>/var/lib/rpm/Installtid: Berkeley DB (Btree, version 9, native byte-order)
<path to rootfs>/var/lib/rpm/Name: Berkeley DB (Btree, version 9, native byte-order)
<path to rootfs>/var/lib/rpm/Obsoletename: Berkeley DB (Btree, version 9, native byte-order)
<path to rootfs>/var/lib/rpm/Packages: Berkeley DB (Hash, version 9, native byte-order)
<path to rootfs>/var/lib/rpm/Providename: Berkeley DB (Btree, version 9, native byte-order)
<path to rootfs>/var/lib/rpm/Requirename: Berkeley DB (Btree, version 9, native byte-order)
<path to rootfs>/var/lib/rpm/Sha1header: Berkeley DB (Btree, version 9, native byte-order)
<path to rootfs>/var/lib/rpm/Sigmd5: Berkeley DB (Btree, version 9, native byte-order)
<path to rootfs>/var/lib/rpm/Triggername: Berkeley DB (Btree, version 9, native byte-order)
```
and we should be able to cope with not having all the data files present, such as here `Filetriggername`
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/1576
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20210311/3e65f334/attachment.html>
More information about the Rpm-maint
mailing list