Bug 1940895
Summary: | [RFE] When files are in "(replaced)" status (in 'rpm -V output), they cannot query their history using the 'rpm --dbpath <db> -qf <file>' command, and need to be able to do this | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 8 | Reporter: | Marion Levine <malevine> | |
Component: | rpm | Assignee: | Michal Domonkos <mdomonko> | |
Status: | CLOSED ERRATA | QA Contact: | Jan Blazek <jblazek> | |
Severity: | high | Docs Contact: | Mariya Pershina <mpershin> | |
Priority: | high | |||
Version: | 8.3 | CC: | jason.mccallister, jcastran, kwalker, lmiksik, malevine, mbanas, mdomonko, pmatilai | |
Target Milestone: | rc | Keywords: | FutureFeature, Patch, Triaged | |
Target Release: | --- | |||
Hardware: | x86_64 | |||
OS: | Linux | |||
Whiteboard: | ||||
Fixed In Version: | rpm-4.14.3-23.el8 | Doc Type: | Enhancement | |
Doc Text: |
.A new `--path` CLI option is added to RPM
With this update, you can query packages by a file that is currently not installed using a new `--path` CLI option. This option is similar to the existing `--file` option, but matches packages solely based on the provided path. Note that the file at that path does not need to exist on disk.
The `--path` CLI option can be useful when a user excludes all documentation files at install time by using the `--nodocs` option with `yum`. In this case, by using the `--path` option, you can display the owning package of such an excluded file, whereas the `--file` option will not display the package because the requested file does not exist.
|
Story Points: | --- | |
Clone Of: | ||||
: | 2072176 (view as bug list) | Environment: | ||
Last Closed: | 2022-05-10 15:28:54 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: | 2072176 | |||
Bug Blocks: |
Description
Marion Levine
2021-03-19 14:00:40 UTC
Just to add additional context, the behaviour change in question is around this commit: commit 9ad57bda4a82b9847826daa766b4421d877bb3d9 Author: Panu Matilainen <pmatilai> Date: Mon Aug 29 16:19:32 2011 +0300 Use RPMDBI_INSTFILENAMES on file queries as well - This changes query behavior quite a bit as files with non-installed status are no longer returned as matches. The rationale is that it makes figuring out dependency issues with the "new" behavior more obvious (but perhaps we should have a switch to enable former behavior). Besides not satisfying dependencies, files with non-installed status are not really owned by the package, as they would not be removed on package removal. diff --git a/lib/query.c b/lib/query.c index 73d64e34a..1e429548b 100644 --- a/lib/query.c +++ b/lib/query.c @@ -409,7 +409,8 @@ static rpmdbMatchIterator initQueryIterator(QVA_t qva, rpmts ts, const char * ar fn = xstrdup(arg); (void) rpmCleanPath(fn); - mi = rpmtsInitIterator(ts, RPMDBI_BASENAMES, fn, 0); + /* XXX Add a switch to enable former BASENAMES behavior? */ + mi = rpmtsInitIterator(ts, RPMDBI_INSTFILENAMES, fn, 0); if (mi == NULL) mi = rpmtsInitIterator(ts, RPMDBI_PROVIDENAME, fn, 0); Essentially, the request is to add the above mentioned switch. Oh, that. I had completely forgotten such a thing... Thank you, Kyle and John, for the thorough analysis of this issue in the associated customer ticket and not only hunting down the root cause, but also finding the corresponding commit(s). Great job! It's going to be that much easier and quicker for us to resolve this! Funny how sometimes the obvious gets lost in the details... This can be achieved with a one-liner Python script that will work on basically any rpm version, replace <file> with the file you're looking to find: python -c "import sys,rpm;[print(h['nevra']) for h in rpm.ts().dbMatch('basenames', sys.argv[1])]" <file> Alternative db paths can be specified by adding rpm.addMacro('_dbpath', '/some/where') before the list comprehension, and of course if one writes it out as a real script you can do far more. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (rpm bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2022:2082 |