Bug 1766487

Summary: libguestfs assumes rpmdb is in Berkeley DB format
Product: [Fedora] Fedora Reporter: Panu Matilainen <pmatilai>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 32CC: rjones
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-03-26 16:12:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1766120, 1935181    

Description Panu Matilainen 2019-10-29 09:16:50 UTC
libguestfs (as of 1.41.5) assumes the rpmdb is in Berkeley DB format - it looks for particular filenames and then uses db_dump to process those. This assumption is not valid since rpm >= 4.13, as rpm supports multiple different database backends.

The only legitimate way to access the rpmdb is through librpm API.

Comment 1 Richard W.M. Jones 2019-11-11 10:11:12 UTC
I guess we might put librpm into the appliance.  (Actually it turns out the
rpm-libs is already in the appliance - I'm not sure what is pulling it in).
But can librpm be pointed to an RPM db in a subdirectory / mountpoint?

Comment 2 Panu Matilainen 2019-11-11 12:11:04 UTC
Sure, librpm simply uses %{_dbpath} macro to locate the database, there's even a cli shortcut for changing it (--dbpath /some/place)

Comment 3 Richard W.M. Jones 2019-11-11 12:28:57 UTC
I mean is this settable from the librpm API?  Anyway I guess this topic needs
investigation.

Comment 4 Panu Matilainen 2019-11-11 12:49:30 UTC
Oh, of course it is. rpm cli is just any other librpm user really.

Macros can be defined and undefined from the API, see rpmPushMacro()/rpmPopMacro()

Comment 5 Ben Cotton 2020-02-11 17:46:48 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 32 development cycle.
Changing version to 32.

Comment 6 Richard W.M. Jones 2021-03-26 16:12:32 UTC
Fixed in libguestfs 1.45.3.